Unary & Server Streaming RPCs
Implement unary calls and server-side streaming to push data from server to client in real time.
gRPC RPC Types
gRPC supports four RPC patterns: Unary (request/response), Server Streaming (client sends one, server sends many), Client Streaming, and Bidirectional Streaming. This lesson covers the first two.
Unary RPC: The Basic Pattern
Unary is the simplest pattern — one request, one response. It looks like a regular function call but travels over HTTP/2 with Protobuf encoding.
// .proto definition
service OrderService {
rpc GetOrder (GetOrderRequest) returns (OrderResponse);
}
message GetOrderRequest { int32 id = 1; }
message OrderResponse { int32 id = 1; string status = 2; double total = 3; }All lessons in this course
- gRPC & Protobuf Fundamentals
- Unary & Server Streaming RPCs
- Client & Bidirectional Streaming
- Deadlines, Cancellation & Interceptors