Redis Adapter doesn't seem to be working
Ive tried using the redis adapter as specified in the docs in combination with the socket.io-emitter in a different process and while the socket.io-emitter is working, and even redis is receiving data, the actual socket.io server is not picking up any events emitted to it.
Redis is connected, its receiving data, and socket.io-emitter is obviously working or else redis wouldn't receive data in redis-cli monitor
var server = require('http').Server(); var io = require('socket.io')(server); var redis = require('socket.io-redis'); io.adapter(redis({ host: 'localhost', port: 6379 })); server.listen(8080);
that is the code i'm using. Whats wrong?
Hi,
Could the socket.io team help the comunity with how to scale a socket.io application on multiple nodes, when stiky sessions are not available?
I am trying to scale a socket.io application, with no success, therefore I forked the sample chat application, here (https://github.com/liviuignat/chat-example-cluster), to try to implement socket.io + redis adapter sample, again with no success.
I actually see no key in redis also. This is also hosted on heroku under http://chat-example-cluster.herokuapp.com/. From what you can see the application has a lot of fails, sometimes it works with no problems, sometimes it fails to connect.
Any help with the "chat-example-cluster" would help a lot the comunity.
Thanks,
I got it working. (This does require sticky sessions) What was confusing (to me) was that the servers don't actually get the events. socket.io redis makes sure that when you broadcast something from one socket.io server instance the clients of all socket.io server instances receive the event. The servers don't receive the events because they're not clients. (You could probably use socket.io-client to also make a server a client).
Yes, with sticky sessions enabled it works. Is it any possibility to have it working without any sticky sessions?
Maybe when you disable the polling transport method?
If you set the transport method to websocket only, the system will work without sticky session.
@liviuignat can you expand on what's not working? AFAIK using the redis-adapter, you need to emit to rooms and not the individual socket instances.
Closing due to inactivity.