4 ms·
This could be solved without trailers by piggybacking on top of server sent events rather than requests with trailers, and terminating a stream with status meta
by raggi 4y ago
This could be solved without trailers by piggybacking on top of server sent events rather than requests with trailers, and terminating a stream with status metadata as a final event.
- Matthias247 4y agoServer sent events are just a potential payload format for response bodies, which allows to encode a potentially infinite amount of distinct messages. Trailers are a different concept since they exist outside of bodies. If the team had decided to only use http body streams for all payload, they could totally have done that without directly using SSE encoding.
- raggi 4y agoSSE adds another thing besides the body encoding, which is a standard content type that implies unbuffered streaming.
- paulgb 4y agoThe underlying data is binary (protobufs), though. It would defeat the purpose to re-encode it as text to send over SSE. Also, IIRC gRPC supports full-duplex, which SSE does not. WebSockets may have been a better fit, as the Chromium developers hinted on the WontFix issue linked in the post.
- raggi 4y agoIn the next web, https://web.dev/webtransport/ https://web.dev/webtransport/ would be the thing to move to. It's a bit nicer under the hood than websockets, though it's also brand new. My comment was less about a full duplex replacement though, and more "how to get something equivalent to trailers, that works in browsers today", and this would enable that.