Types of gRPC APIs
Learn about the different streaming options in gRPC.
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 calls. The clients know all the service methods. On the other hand in REST, service methods are represented by resource endpoints identified by URLs, and clients interact with these endpoints by sending HTTP requests. The actual methods executed are hidden from the client. ...