Re:Native Socket.IO and Android
by Thaxll on Tuesday January 20, 2015 @10:57AM
(#8917505)
Since almost all platforms support Websocket, is it necessary to use Socket.io?
[ Parent
| on HN ]
On top of its transport layer abstraction, socket.io adds various useful features including events, rooms, namespacing, efficient/convenient (de)serialization and network callbacks. I've been using it in websockets-only mode for various projects, because I don't care for slower / less reliable transports but still want the extra features.
Re:Native Socket.IO and Android
by jeffasinger on Tuesday January 20, 2015 @12:51PM
(#8918219)
While Websocket has good supports by browsers, it doesn't always handle switching between networks correctly, also, some networks disallow Websockets altogether, or drop websocket connections over HTTP, but not over HTTPS.
Socket.io (especially > 1.0) solves these issues with a layer by having smart reconnection mechanisms and starts by connecting over plain old HTTP longpolling, and upgrades the connection to use websockets if they're available and work.
It's not. There's an under-appreciated NPM module which is/was shared by Socket.IO that only handles the low-level WebSocket protocol for NodeJS:
https://www.npmjs.com/package/websocket.io
You can use that, and the built-in WebSocket object in modern browsers.