# rpc-no-client-streaming

Source: https://api-genie.dev/docs/linter/protobuf/rules/rpc-no-client-streaming

A rule of the Protobuf linter, which reads proto3 files; the reader rejects proto2 and editions files. Since 0.9.0. In the rulesets: All at error.

This rule checks whether any RPC uses client streaming.

## Rule details

Client-streaming RPCs, whose request is declared with `stream`, are not supported by every
transport: gRPC-Web and most HTTP/JSON gateways, for example, cannot carry them. They are also
harder to retry, load-balance and debug than unary RPCs.

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

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

Turn the rule off if all clients use a transport that supports streaming, such as gRPC over HTTP/2.
To allow a single RPC, add an `// apigenie-lint-disable rpc-no-client-streaming` comment to it.

## Examples

**Good**.

```proto
syntax = "proto3";

package acme.pets.v1;

service PetService {
  rpc UploadPhoto(UploadPhotoRequest) returns (UploadPhotoResponse);
}

message UploadPhotoRequest {
  bytes photo = 1;
}

message UploadPhotoResponse {
  string url = 1;
}
```

**Bad**. The linter reports `RPC 'UploadPhotos' should not use client streaming`.

```proto
syntax = "proto3";

package acme.pets.v1;

service PetService {
  rpc UploadPhotos(stream UploadPhotosRequest) returns (UploadPhotosResponse);
}

message UploadPhotosRequest {
  bytes photo = 1;
}

message UploadPhotosResponse {
  repeated string urls = 1;
}
```
