Bidirectional Streaming

Bidirectional streaming is one of the four types of RPC methods that can be defined in a gRPC API. With bidirectional streaming, both the client and the server can send a sequence of messages to each other by using two independent streams. It’s not necessary for the client to wait until the server finishes sending all the messages to send new requests. Similarly, the server doesn’t wait until the client has sent all the messages before responding.

Flow of bidirectional streaming between the client and the Pub/Sub API service

The Subscribe and ManagedSubscribe (beta) methods use bidirectional streaming to subscribe to an Event Bus topic. The PublishStream method also uses bidirectional streaming. For more information, see Core concepts, architecture and lifecycle in the gRPC documentation.

See Also