6 ms·
I think this is different than server push like WebSockets; this is all about pushing down resources the server suspects you'll need.
by ahupp 6y ago
I think this is different than server push like WebSockets; this is all about pushing down resources the server suspects you'll need.
- josephg 6y agoWebsockets are different again from both server push and h2 streams. Server push was a feature added in http2 for populating the browser’s cache. Websockets are an http/1.1 extension for tcp-like bidirectional messaging. Server push, websockets, h2 steams and webtransport are all different things.
- brabel 6y agoDon't forget Server Sent Events[1] as well, which is yet another different technology. [1] https://en.wikipedia.org/wiki/Server-sent_events https://en.wikipedia.org/wiki/Server-sent_events
- techdragon 6y agoYea but unlike http2 push, server sent events were actually useful! You could use it super easily and by holding open a connection and pushing down little json or XML payloads you could build all sorts of things easily in JavaScript. I even saw super basic chat functionally built using two Iframes a form in one and the chat log pushed back from the server as a stream of valid but open ended HTML abusing how lax the browser was about parsing missing certain closing tags at the time. SSE was and still is super easy to use and a very useful option if you can’t or don’t want to shift to web sockets.
- earthboundkid 6y agoMost applications that use WebSockets should be using SSE instead, but WS has better mindshare, and SSE doesn't work in IE11.
- josephg 6y agoSSE can be polyfilled to work in IE11. It can be implemented on top of XHR from ie7 or so onwards. Some caching proxies struggle with it though, because they try to buffer an entire response before forwarding it. And it’s 1 way. For something like collaborative editing, crafting a POST request for every keystroke feels wasteful, though it works great in practice.
- bonkabonka 6y agoI'd second that! I use the heck out of SSE to add update notifications to various of my apps because it's just so easy to do. Have it glued to a Redis stream (or pubsub channel) with https://github.com/bonkabonka/sseredis https://github.com/bonkabonka/sseredis (though that shim looks like it needs a bit of love and a better README.)