streams
. 流对于聊天、观察或块数据传输等情况很有用4 MB
HTTP1.1
,而 gRPC 使用的是更加高效的HTTP2
。Google 提供的解決方案是利用一個 proxy 架設在後端,將前端所有的 HTTP1.1 流量轉換成 HTTP2。brew install protobuf brew install protoc-gen-grpc-web
protoc -I protos \ --js_out=import_style=commonjs:grpc-client/src/protos \ --grpc-web_out=import_style=commonjs+dts,mode=grpcweb:grpc-client/src/protos \ hero.proto
grpcurl localhost:3001 describe
grpcui -plaintext localhost:3001
protoc-gen-js: program not found or is not executable Please specify a program using absolute path or make sure the program is available in your PATH system variable --js_out: protoc-gen-js: Plugin failed with status code 1.
brew install protobuf@3 brew link --overwrite protobuf@3