I seem to be having an issue where socket.io broadcasts in my node.js app on Heroku don't seem to work when I have more than 1 dyno. As soon as I scale it to 1, it works perfectly. Is there anything I need to know about this? Maybe there is a different way to broadcast to all dynos? Please elt me know if I need to provide more info or code.
Socket.io + NodeJS doesn't work on Heroku.
On Scalingo, your application must listen to the port defined in the PORT environment variable dynamically defined by the platform.
Key Differences between WebSocket and socket.ioIt provides the Connection over TCP, while Socket.io is a library to abstract the WebSocket connections. WebSocket doesn't have fallback options, while Socket.io supports fallback. WebSocket is the technology, while Socket.io is a library for WebSockets.
If you're running on multiple dynos/servers then you have to configure socket.io to use a non-in-memory session store like the RedisStore
. The socket.io documentation has details and there's more discussion here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With