wire / wire-format / grpc-frame
gRPC messages on the wire are framed with a 5-byte prefix: 1 byte compression flag (0 = uncompressed, 1 = compressed) followed by a 4-byte big-endian message length, then the (possibly compressed) serialized protobuf message. Used over HTTP/2 DATA frames.
aka: gRPC length-prefixed message frame
spec: gRPC over HTTP/2 (grpc.github.io)
gRPC messages on the wire are framed with a 5-byte prefix: 1 byte compression flag (0 = uncompressed, 1 = compressed) followed by a 4-byte big-endian message length, then the (possibly compressed) serialized protobuf message. Used over HTTP/2 DATA frames.
| field | size | meaning |
|---|---|---|
| Compression flag | 1 byte | 0 = message is not compressed, 1 = message is compressed (per grpc-encoding header). |
| Message length | 4 bytes | Length of the message payload in bytes (big-endian, max 2^32-1, default limit 4 MiB). |
| Message payload | = length | Serialized protobuf (or other codec) bytes; compressed if flag = 1. |
example:
00 00 00 00 0a 0a 08 48 65 6c 6c 6f 20 67 52 50 43
Uncompressed frame, 10-byte payload 'Hello gRPC' (protobuf string field)
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/grpc-frame
or /wire-format/grpc-frame.json