...

/

Client-Streaming gRPC Calls

Client-Streaming gRPC Calls

Learn about the client-streaming call type in gRPC and how to implement it.

Client-streaming calls work by having a client send a stream of messages to the server. Then, when the client closes the stream, the server returns a single object as the response. This functionality is useful in situations where a client would need to send periodic updates to the server. For example, the client might be an IoT device that sends some sensor metrics to the server. Being able to write those into a stream saves bandwidth because we won't have to make a separate request for every metric being sent.

Press + to interact
Message exchange in a client-streaming gRPC call
Message exchange in a client-streaming gRPC call

To implement the client-streaming functionality, we have the following code widget, which already contains the code for both the client and server applications.

syntax = "proto3";

option csharp_namespace = "BasicGrpcService";

package basic_grpc_service;

service Chatbot {
  rpc SendMessage (ChatRequest) returns (ChatReply);
}

message ChatRequest {
  string name = 1;
  string message = 2;
}

message ChatReply {
  string message = 1;
}
Basic gRPC client and server projects

To create an example of a client-streaming RPC we'll ...