Types of gRPC APIs
Explore the four types of gRPC APIs—Unary, Server Streaming, Client Streaming, and Bidirectional Streaming. Understand how each works with practical examples, how data is streamed, and the role of the StreamObserver interface for handling communication between clients and servers. This lesson helps you identify which API type fits different application needs and how to define them in protocol buffers.
gRPC communication styles
gRPC provides various streaming options for handling communication between clients and servers. Four types of streaming are available:
Unary: request-response model
Server streaming: The server sends continuous messages to the client.
Client streaming: The client sends continuous messages to the server.
Bidirectional streaming: The client and server send continuous messages to each other.
Depending on the nature of the application and the requirements of data exchange, developers can choose between them to create efficient and interactive systems. In all of these streaming types, a special interface called StreamObserver is used to handle data flows.
RPC and REST communication differs in terms of the service methods. In RPC, service methods are invoked directly using method ...