hyperium / tonic

A native gRPC client & server implementation with async/await support.
https://docs.rs/tonic
MIT License
9.76k stars 997 forks source link

Ability to send trailing metadata (trailers) from server-streaming methods. #1370

Open Palmik opened 1 year ago

Palmik commented 1 year ago

I may have missed this functionality, but is there a way to send trailing metadata (trailers) from a server-streaming situation. Imagine a simple scenario of a method which outputs several messages of random length, and then you want to send a header that contains the cumulative length of those messages (or other information that you can only determine once you have sent out some or all of the messages).

starsoccer commented 1 year ago

Did you ever figure this out? Looking to do something similar but include a unique ID on each request. Found this discussion but not super clear how to use it, https://github.com/hyperium/tonic/discussions/1101