grpc_frame library

gRPC Length-Prefixed-Message framing.

Implements the gRPC wire format for HTTP/2 DATA frames as specified in grpc/doc/PROTOCOL-HTTP2.md.

Frame layout:

Byte 0:    Compressed-Flag (0 = uncompressed, 1 = compressed)
Bytes 1-4: Message-Length   (4 bytes, big-endian unsigned int32)
Bytes 5+:  Message data     (protobuf binary)

Functions

extractServiceMethods(Map<String, Object?> serviceDescriptor) List<Map<String, Object?>>
Extract service method descriptors from a FileDescriptorProto-like map.
grpcDecodeFrame(List<int> buffer, int offset) Map<String, Object?>
Decode a single gRPC frame from buffer starting at offset.
grpcDecodeFrames(List<int> buffer) List<Map<String, Object?>>
Decode all gRPC frames from buffer.
grpcEncodeFrame(List<int> messageBytes, {bool compressed = false}) List<int>
Encode a gRPC frame: 1-byte compression flag + 4-byte big-endian length + message bytes.
grpcEncodeFrames(List<List<int>> messages, {bool compressed = false}) List<int>
Encode multiple gRPC frames (for streaming).