I have HAProxy
which serve multiple servers with nodejs on expressjs. I have added to that express socket.io and to make them work i tried to connect them with socket.io-redis
and socket.io-ioredis
. All looks to be connected without any error but when an user get his socket connected with different server from other user, their emits don't read don't send to other servers.
Nodejs setup
var app = express();
var server = require('http').Server(app);
var io = require('socket.io').listen(server);
var redis = require('socket.io-ioredis');
io.adapter(redis({ host: 'serverIP', port: 6565 }));
server.listen(6565);
How do i do the emit:
io.to(roomID).emit(event, object);