Re:gRPC-Go Engineering Practices
by dguaraglia on Friday January 26, 2018 @01:25AM
(#16237393)
Right, but server-sent events work only one way: from server to client. gRPC allows you to create bi-directional streams, where both the client and server are pumping data.
Chunked encoding allows to do something like what gRPC does, but it's my understanding (I might be wrong) that the data needs to be base64 encoded, whereas HTTP/2 supports raw byte arrays to be sent.
HTTP/1 responses carry raw bytes, and chunked encoding doesn't affect that (just some packet length prefixing).
If you mean binary data would need to be Base64-encoded with server-sent events, that's true. SSE uses text/event-stream as the content type, which is expected to be text. It would be interesting if someone defined a content type for streaming binary events.
Server sent is not stream, it's a pseudo bad implementation on top of http 1.1.
HTTP has supported streaming data for years, e.g. Server-Sent Events[0]. The short version is that you GET a URL, and the body keeps on arriving forever. I'm pretty sure that we had this sort of HTTP streaming back in the late 90s …
I'll grant that many JSON-oriented pseudo-REST clients probably don't support it, though.
[0] https://en.wikipedia.org/wiki/Server-sent_events