More Than One Shape
A gRPC method is not limited to one request and one response. Because it runs over a multiplexed transport, it supports four streaming modes.
The Four Modes
Each mode differs in how many messages flow on each side.
- Unary sends one request and gets one response, the classic call.
- Server streaming sends one request and receives a stream of responses.
- Client streaming sends a stream of requests and gets one response.
- Bidirectional streaming sends and receives streams at the same time.
When To Use Each
The right mode follows the data flow you actually have.
- Use server streaming to push many results, such as search hits or live updates.
- Use client streaming to upload many chunks and get one summary.
- Use bidirectional streaming for chat like or interactive exchanges.
All four modes still ride one logical call with one set of metadata and one final status. Streaming keeps a connection open, so you must handle backpressure and decide what happens if either side stops reading.
Key idea
gRPC offers unary, server streaming, client streaming, and bidirectional modes, letting you match the call shape to your data flow while still keeping one logical call with one final status.