|
|
|
|
|
by babuskov
4480 days ago
|
|
Interesting, but I'm not using Redis nor MemoryStore. I gave each machine behind HAProxy a different hostname (mapped to the same IP address), and I route the clients in roundrobin fashion to each of those before they open the page with socket.io javascript. It works like this: - 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. |
|