How gRPC supports keyword stream when define a rpc protobuf?

Viewed 263

I am new to gRPC and protobuf. I notice that gRPC use the keyword stream as the filed rule of arguments when defining a service. But, i can't find any defination of stream in the documents of Protobuf. How gRPC can use stream as the filed rule?

2 Answers

The stream concept is specific to gRPC, and is covered in the core concepts documentation of gRPC; the short version is:

rpc Unary(RequestType) returns (ResponseType);
rpc ServerStreaming(RequestType) returns (stream ResponseType);
rpc ClientStreaming(stream RequestType) returns (ResponseType);
rpc Duplex(stream RequestType) returns (stream ResponseType);
  // nomenclature: duplex === bidirectional streaming
Related