Hacker News new | ask | show | jobs
by oboopfmlrmnmn 3195 days ago
Just wondering, why are people still using socket.io and not standard websockets, as available in every browser since several years now?
3 comments

If you don't mind performance, using socket.io gives you stay-alive on the ws connection. If you don't mind writing the 5 lines of code it takes to implement stay-alive for normal websockets then socket.io makes no sense anymore.
I'm personally using it because it gives me:

1. Rooms

2. Disconnects and reconnects,

3. Fallack solutions

for free.

Although not for a game. I trust that its just not made for that kind of performance.

But for a messaging app its actually quite decent.

It provides fallback connection methods if WS connection fails, as it can do if you have, for example, a HTTP/1.0 only proxy between you and the client. For example it was not that long ago that nginx did not support proxying HTTP/1.1. It is getting less and less relevant but at least for me the socket.io code has worked for a long time and there hasn't been a need to rewrite it.