node.js 0.6 socket.io 0.9.6
This version of socket.io has a nasty bug in jsonp protocol handling which I patched manually by merging some change from a newer version, but it does work fine.
To make it scale, I run multiple node processes. In the last 300+ days each of those has between 1000 and 2000 concurrent connections all the time and it works fine. Except that there is some memory leak (I'm not sure if it's related to socket.io or some other lib), so I restart each server once a week (it's done automatically each Sunday at 2am).
I had my eye on SockJS since 2012, and it looks like newer versions are really good, but I'd need upgrade to newer nodejs and this is simply not possible for the existing projects as many used modules are not available.
However, if you're starting a new project, it's worth testing and see which performs better.
take a look at this discussion https://github.com/LearnBoost/socket.io/issues/1303#issuecom...
- client opens a page on HAProxy load-balancer picked server
- the actual node server that receives the request, redirects the browser to its custom hostname using the same URI
- client opens the same page on the particular server and socket.io connects to that subdomain
This ensures that all future requests (if socket.io connection is broken) will go to the same server without Redis, MemoryStore, cookies or whatever.
Drawbacks:
- one additional HTTP redirect when page that contains socket.io is loaded (luckly, in games there aren't many of those)
- if you want to retire some sub-domain hostname, you have to be careful to allow existing clients to re-connect somewhere else. Not really a problem for my setup, but YMMV.
Some 11% of clients are using XHR or JSONP protocols and it it Just Works(tm), I did not add anything special.
You're the first person I've heard that was able to run vanilla Socket.io at such scale. I know Trello and some other shops use Socket.io, but they've forked & changed it to something that looks nothing like the original[2].
How this is helping?
"Flash is absolutely not required for Socket.IO to function. If Flash is available, it'll be leveraged, as it provides almost the same capabilities as WebSocket. If it's not, the next best transport will be chosen." - Socket.io