Metadata and Header/Trailer in Go applications

678 views
Skip to first unread message

Amit Saha

unread,
Jun 17, 2021, 3:59:41 AM6/17/21
to grpc.io
Hi all - I will use meta-data to mean generic information that is
usually sent and received besides the request/response.

So far this is what i think is the case:
(Referring to https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md)

- For clients to send any kind of meta-data, use context + metadata to
create a new context
- For servers to send back any kind of meta use, header and trailers,
which the client can access using Header and Trailer Call Options.

Is there any reason why this is so - why couldn't we use the Header
(and Trailers) to send the meta-data to the server as well instead of
creating a new context?

Thanks,
Amit.

Zach Reyes

unread,
Jul 28, 2021, 7:07:16 PM7/28/21
to grpc.io
https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md specifies that client messages involve headers and data only, and no trailers. Thus, there is no concept of trailers sent from the client side. However, the reason the two examples are different, is one is at the RPC layer API, and the other is at the ServerStream layer API.
Reply all
Reply to author
Forward
0 new messages