Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

heroku multiple dyno socket.io

I am developing a node.js application with Socket.io and deploying same on Heroku Dyno. Socket.io is using RedisStore with its PUB/SUB. Socket.io client works perfectly fine with one dyno in heroku. But when I increase the number of dyno to more than one (say two), socket io client request does not work.

Please let me know if any specific configuration on client side is needed while setting up heroku for multiple web dyno having socket.io support.

like image 984
user2771363 Avatar asked Jan 17 '14 17:01

user2771363


2 Answers

Sorry, but heroku doesn't support sticky session and it's not supported by Socket.io

Sticky load balancing If you plan to distribute the load of connections among different processes or machines, you have to make sure that requests associated with a particular session id connect to the process that originated them.

Using multiple nodes

like image 93
Loïc Calvy Avatar answered Sep 20 '22 00:09

Loïc Calvy


There's a great thread in an issue on the engine.io github. Helped me understand the issue of sticky sessions, engine.io, and heroku a lot better.

like image 29
OdieO Avatar answered Sep 17 '22 00:09

OdieO