# rpc-no-server-streaming

Source: https://apigenie.pl/docs/linter/protobuf/rules/rpc-no-server-streaming

This rule checks whether any RPC uses server streaming.

## Rule Details

Server-streaming RPCs, whose response is declared with `stream`, are not supported by every
transport: most HTTP/JSON gateways, for example, cannot carry them, and long-lived streams are
harder to load-balance and debug than unary RPCs.

The `rpc-no-server-streaming` rule reports `RPC '<rpc>' should not use server streaming` for
every RPC with a streamed response, including bidirectional streaming RPCs.

The rule is only part of the `all` ruleset.

## Configuration

This rule has no options.

## Examples

**Good**.

```proto
syntax = "proto3";

package acme.pets.v1;

service PetService {
  rpc ListPets(ListPetsRequest) returns (ListPetsResponse);
}

message ListPetsRequest {
  int32 page_size = 1;
  string page_token = 2;
}

message ListPetsResponse {
  repeated string names = 1;
  string next_page_token = 2;
}
```

**Bad**. The linter reports `RPC 'WatchPets' should not use server streaming`.

```proto
syntax = "proto3";

package acme.pets.v1;

service PetService {
  rpc WatchPets(WatchPetsRequest) returns (stream WatchPetsResponse);
}

message WatchPetsRequest {
  string shelter = 1;
}

message WatchPetsResponse {
  string name = 1;
}
```

## When Not to Use It

You may disable this rule if all clients use a transport that supports streaming, such as gRPC
over HTTP/2, and some RPCs need to push updates. To allow a single RPC, add an
`// apigenie-lint-disable rpc-no-server-streaming` comment to it.

## Compatibility

This rule is compatible with proto3 files. proto2 and editions files are rejected by the reader
and are not linted.
