3 ms·
> Unlike the rest of the technologies, [Websockets] seems to have somewhat of a purpose — even if it’s been made redundant by things like HTTP/2 streams. ... Gi
by bijection 6y ago
> Unlike the rest of the technologies, [Websockets] seems to have somewhat of a purpose — even if it’s been made redundant by things like HTTP/2 streams.
...
Give it a few months, and there will be some NodeJS fad where everyone wants to re-implement HTTP with WebSockets, and load every asset for their website through JavaScript to save a tenth of a microsecond in some edge case involving tech buzzword bingo. ... Once this happens, disabling WebSockets breaks the internet.
To be fair to Websockets, they've been around for almost a decade, pre-dating http/2 by a few years, and the duplex communication they offer is a fundamental building block for all kinds of stuff, from games to trading websites to chat systems.
Although the Battery API is a different story, the author's point about Websockets seems to be based on somehow having overlooked them for quite a while.
- TazeTSchnitzel 6y agoYes, and WebSockets are a clean and fast replacement for horrible hacks that preceded them. Nobody liked having to constantly poll the server one way or another, or god forbid, use Flash.
- Thorrez 6y agoOne alternative to repeated polling or Flash is hanging GETs. But yes, that's a pretty weird hack.
- cygx 6y agoThat's called 'long polling'. You can also leverage HTTP 1.1 chunked transfers. Cf https://en.wikipedia.org/wiki/Comet_(programming) https://en.wikipedia.org/wiki/Comet_(programming)
- arantius 6y agoThat's unidirectional. Websockets allow fully stateful bidirectional data transfer (just like a regular socket). They're wonderful when that's what you need.
- Thorrez 6y agoYeah, you pair hanging GETs with XHR to get bidirectional transfer. Yeah I agree websockets are a lot easier than the hacky hanging GETs + XHR setup.