GRPC

来自WHY42

gRPC vs HTTP

Feature gRPC HTTP APIs with JSON
Contract Required (.proto) Optional (OpenAPI)
Protocol HTTP/2 HTTP
Payload Protobuf (small, binary) JSON (large, human readable)
Prescriptiveness Strict specification Loose. Any HTTP is valid.
Streaming Client, server, bi-directional Client, server
Browser support No (requires grpc-web) Yes
Security Transport (TLS) Transport (TLS)
Client code-generation Yes OpenAPI + third-party tooling

[1]