Does Socket.io work with Heroku at all?

I tried to find answers to this question, and all I can find is the old "no, this is not so" or "in the future it will be."

I tried socket.io-redis to no avail. On Heroku, one dyno will create working sockets, moreover, and you will receive the following errors from Socket.io, which means that scaling does not occur.

{"code": 1, "message": "Session ID unknown"}

It seems to me that WebSocket support "Heroku" claims that this is a really cruel joke on developers.

Edit: Heroku supports websockets, but it just won't work with a socket.io cluster with Redis. Therefore, I only run one instance designed for sockets. When I want to use sockets with Heroku.

+7
source share
1 answer

: I own the Node.js platform in Heroku.

tl; dr: We have support for multi-dyno socket.io in the private beta.

Heroku has full support for WebSockets, which do not require similar sessions, and are not the same as socket.io.

Socket.io is a higher-level software-real-level abstraction that uses WebSockets as one of many potential transports. Socket.io really requires session convergence, and socket.io-redis (or similar) is required to implement multi-node event sharing for socket.io (on Heroku or elsewhere).

Most sticky session implementations break 12factor architecture . We have a flexible, scalable, flip-key-sticky beta session running right now for socket.io, meteor and sockjs users. If you want to add, write to me at hunter@heroku.com ; we will open it to the general public in the next few weeks.

+2
source share

All Articles