mattstyles / koa-socket

Sugar for connecting socket.io to a koa instance
242 stars 50 forks source link

Does not play nice with adapters #32

Open kevinludwig opened 7 years ago

kevinludwig commented 7 years ago

in your broadcast method, you're simply doing a forEach over every socket and emitting directly to the socket. I think when you do that you're not allowing for the fact that there may be multiple nodes (and thus sockets that should be broadcast to that are not in the same process or on the same machine).

I think you can fix this by doing io.sockets.emit(...) to emit to all sockets and not just the in-process ones.

Note: I haven't tried this yet but its the impression I get when I read the code; and I'm unable to get multi-instance working with socket.io-redis.