🔌 gRPC Beginner

What is server streaming RPC?

Answer

Server streaming RPC allows the client to send one request and receive a stream of multiple responses from the server. Defined as: rpc ListTransactions(DateRange) returns (stream Transaction);. The server writes multiple messages to the stream as they become available, and the client reads them one by one as they arrive. The server signals completion by closing the stream. Server streaming is ideal for: returning large result sets without buffering everything in memory (e.g., paginating a large database query), pushing live updates in response to a subscription request (e.g., subscribing to price updates), or streaming file/media content. The client reads from the stream using a for-range loop (Go) or async iterator (Python) until the stream ends.