Answer the question
In order to leave comments, you need to log in
SocketIO how to communicate between servers?
Good evening! Could you tell me (
For example, there is an Nginx balancer and several NodeJS servers on different hosts.
The SocketIO documentation says that in nginx, you need to use ip_hash to assign a cookie, and already in NodeJS you need to connect an adapter, so
var io = require('socket.io')(3000);
var redis = require('socket.io-redis');
io.adapter(redis({ host: 'localhost', port: 6379 }));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question