4 ms·
My personal browser streaming TL;DR goes something like this: * Start with SSE * If you need to send binary data, use long polling or WebSockets * If you nee
by apitman 5y ago
My personal browser streaming TL;DR goes something like this:
* Start with SSE
* If you need to send binary data, use long polling or WebSockets
* If you need fast bidi streaming, use WebSockets
* If you need backpressure and multiplexing for WebSockets, use RSocket or omnistreams[1] (one of my projects).
* Make sure you account for SSE browser connection limits, preferably by minimizing the number of streams needed, or by using HTTP/2 (mind head-of-line blocking) or splitting your HTTP/1.1 backend across multiple domains and doing round-robin on the frontend.
[0]: https://rsocket.io/ https://rsocket.io/
[1]: https://github.com/omnistreams/omnistreams-spec https://github.com/omnistreams/omnistreams-spec