RPC framework dùng Protocol Buffers (protobuf).
- Nhanh hơn REST (binary encoding, HTTP/2).
- Dùng khi: microservices internal communication, streaming (bidirectional), cần type safety chặt.
- Define service trong .proto file →
protocgenerate Go code. - Hỗ trợ: unary, server streaming, client streaming, bidirectional.
gRPC is an RPC framework using Protocol Buffers (protobuf).
- It is faster than REST thanks to binary encoding and HTTP/2.
- Use it for: microservice-to-microservice communication, streaming (bidirectional), and when strong type safety is required.
- Define your service in a .proto file →
protocgenerates Go code. - Supports: unary, server streaming, client streaming, and bidirectional streaming.