2 ms·
Yeah, sorry. In socket.io it’s 2 lines. You need 5 lines with browser APIs :). You simply get stuff like auto-reconnect and graceful failover to long polling f
by szastamasta 5y ago
Yeah, sorry. In socket.io it’s 2 lines. You need 5 lines with browser APIs :).
You simply get stuff like auto-reconnect and graceful failover to long polling for free when using socket.io
- tekknik 5y ago2 lines vs 5 lines. did you check your payload size after adding socket.io? you added way more than 2 lines. long polling shouldn’t be needed anymore, and auto reconnect is trivial to implement.
- coder543 5y agoSSE EventSource also has built-in auto-reconnect, and it doesn’t even need to support failover to long polling. Neither of those being built into a third party websocket library are actually advantages for websocket… they just speak to the additional complexity of websocket. Plus, long polling as a fallback mechanism can only be possible with server side support for both long polling and websocket. Might as well just use SSE at that point.