🔌 gRPC Beginner

What is bidirectional streaming RPC?

Answer

Bidirectional streaming RPC allows both client and server to send independent streams of messages to each other simultaneously. Defined as: rpc RouteChat(stream RouteNote) returns (stream RouteNote);. Both sides read from and write to their respective streams in any order — neither side needs to finish before the other responds. The streams are independent, operating over a single HTTP/2 connection. Use cases: real-time chat applications, multiplayer game state synchronization, bidirectional telemetry (client streams sensor data, server streams commands back), collaborative editing. Bidirectional streaming is gRPC's most powerful but most complex pattern, requiring careful coordination of when each side sends, receives, and closes its stream.