Understand gRPC-Web framing, Envoy transcoding, protobuf binary encoding, server streaming, and JSON transcoding.
0 / 5 completed
1 / 5
Why can browsers not use standard gRPC directly?
Browser limitation: HTTP/2 trailers carry gRPC status codes after the response body finishes. Browsers deliberately hide trailers from JavaScript for security. gRPC-Web works around this by encoding trailers as a special frame at the end of the response body, making them accessible to JavaScript.
2 / 5
What role does an Envoy proxy play in a gRPC-Web deployment?
Envoy transcoding: the browser sends a gRPC-Web request (base64 or binary encoded) to Envoy. Envoy speaks real HTTP/2 gRPC to the backend, receives the response with proper trailers, and re-encodes it as gRPC-Web for the browser. This allows backend services to remain standard gRPC.
3 / 5
How does protobuf binary encoding compare to JSON in gRPC-Web messages?
Protobuf encoding: field names are not sent over the wire — only field numbers. Variable-length integers use varint encoding. A message with string name = 1; int32 age = 2 sends only the tag byte, value length, and bytes — far smaller than {"name":"Alice","age":30} in JSON.
4 / 5
What is gRPC-Web server streaming and how does it work in a browser?
Server streaming: gRPC-Web supports server-to-client streaming by encoding multiple length-prefixed protobuf frames in the HTTP response body. The gRPC-Web client library reads the body as a stream and invokes your message handler for each decoded frame, enabling real-time data feeds in the browser.
5 / 5
What is protobuf JSON transcoding in the context of gRPC?
HTTP/JSON transcoding: with google.api.http annotations in the .proto file, a gateway layer (grpc-gateway or Envoy) maps GET /users/{id} to the GetUser(GetUserRequest) RPC. The same service implementation serves both traditional REST clients and native gRPC clients without duplication.