Pergunta

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.

Foi útil?

Solução

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

Outras dicas

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.

Sticky Sessions are now supported by Heroku - but only if you join their development (beta) program.

In my experience Heroku works well with socket.io when combined with the Socket.io_Redis plugin and that enabled setting.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top