🔌 gRPC
Beginner
What is unary RPC?
Answer
Unary RPC is the simplest and most common gRPC pattern — the client sends a single request and waits for a single response from the server, similar to a traditional function call. It is defined in a .proto file as: rpc GetProduct(GetProductRequest) returns (Product);. When the client calls this method, gRPC serializes the request to Protobuf, sends it over HTTP/2 to the server, the server processes it, serializes the response, and returns it. The client receives the response and deserializes it. Unary RPC is best for lookups, CRUD operations, and any request-response interaction. It behaves similarly to REST GET/POST but with Protobuf serialization and HTTP/2 transport benefits.