gRPC FAQ
- 不支持 Prefix
- grpc/grpc-web#702GitHub Issuegrpc/grpc-web#702
- grpc/grpc-dotnet#110GitHub Issuegrpc/grpc-dotnet#110
- Support gRPC over HTTP/3 grpc#19126GitHub Issuegrpc/grpc#19126
- gRPC tunneling grpc#14101GitHub Issuegrpc/grpc#14101
Limits
- 请求 Message 默认最大 4MB
- 响应 Message 默认无限制
- Web/ConnectRPC
- 支持 Server Streaming
- 不支持 Client Streaming
- HTTP Header
- Cloudflare 32 KB, 单个 16 KB
- Apache - 8K
- Nginx - 4K-8K
- IIS - 8K-16K
- Tomcat - 8K – 48K
- Node (<13) - 8K; (>13) - 16K
proto3 optional
- optional 会返回 zero value
- 无法区分空值 和 optional
- 可以使用额外的 has 方法来判断是否存在
- proto v3.15 - 2020-04-23 增加 optional
- v3.12-v3.14 使用
--experimental_allow_proto3_optional - 底层使用 oneof 实现
- v3.12-v3.14 使用
- 折中方案
- 使用 oneof
- 使用 google.protobuf.FieldMask
- 使用 Message 类型 - 还是会使用 pointer - 例如
google.protobuf.StringValue替代 string
- 参考
- Missing value/null support for scalar value types in proto 3 protocolbuffers/protobuf#1606GitHub Issueprotocolbuffers/protobuf#1606
- golang/protobuf#15GitHub Issuegolang/protobuf#15
- protobuf/docs/field_presence.mdGitHub 文件protocolbuffers/protobuf/docs/field_presence.md
- edgedb-go#150GitHub Issueedgedb/edgedb-go#150
Trailer
gRPC 实现依赖 HTTP Trailer 能力,类似 longpulling。
- Why Does gRPC Insist on Trailers?
- Headers/Trailer
- fetch 不支持 trailer fetch#981GitHub Issuewhatwg/fetch#981
- 因此 web 不支持直接使用 grpc
- deno 不支持 grpc - 实现了 fetch
transport: Error while dialing reading server HTTP response: unexpected EOF
plaintext
关联信息
反向链接、本文链接的其他页面和外部资料。
参考资料
GitHub10 条
- edgedb/edgedb-go#150github.com/edgedb/edgedb-go/issues/150
- golang/protobuf#15github.com/golang/protobuf/issues/15
- grpc/grpc-dotnet#110github.com/grpc/grpc-dotnet/issues/110
- grpc/grpc-web#702github.com/grpc/grpc-web/issues/702
- grpc/grpc#14101github.com/grpc/grpc/issues/14101
- grpc/grpc#19126github.com/grpc/grpc/issues/19126
- grpc/proposalgithub.com/grpc/proposal
- protocolbuffers/protobuf/docs/field_presence.mdgithub.com/protocolbuffers/protobuf/blob/main/docs/field_presence.md
- protocolbuffers/protobuf#1606github.com/protocolbuffers/protobuf/issues/1606
- whatwg/fetch#981github.com/whatwg/fetch/issues/981
其他外链3 条
- carlmastrangelo.com/blog/why-does-grpc-insist-on-trailerscarlmastrangelo.com/blog/why-does-grpc-insist-on-trailers
- developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Trailerdeveloper.mozilla.org/en-US/docs/Web/HTTP/Headers/Trailer
- developers.cloudflare.com/pages/configuration/headersdevelopers.cloudflare.com/pages/configuration/headers