3 ms·
Yes, 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
by TazeTSchnitzel 6y ago
Yes, 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.