"Life is all about sharing. If we are good at something, pass it on." - Mary Berry

How a gRPC message uses length-prefixed framing?

2020-05-06

Categories: DevOps Networking

Once we have the encoded data to send to the other end, we need to package the data in a way that other end can easily extract the information. gRPC uses a message framing technique called length-prefixed framing.

Filter gRPC messages:

$ tshark -r grpc.pcapng -Y 'grpc'

Find out a stream: DATA:

216 923.033355    127.0.0.1 → 127.0.0.1    GRPC 108 DATA[1] (GRPC) (PROTOBUF)

and show the packet details:

tshark -r grpc.pcapng -Y "frame.number == 216" -V
HyperText Transfer Protocol 2
    GRPC Message: /book.BookInfo/getBook, Request
        Compressed Flag: Not Compressed (0)
        Message Length: 38
        Message Data: 38 bytes

Tags: grpc protocol-buffers length-prefixed-framing

Edit on GitHub