mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-20 15:30:39 +01:00
Allow single-host clusters to not send pubsub and socket.io messages through the database. (#6659)
* Allow single-host clusters to not send pubsub and socket.io messages through the database. * Fix lint errors.
This commit is contained in:
committed by
Barış Soner Uşaklı
parent
148fc96a3a
commit
c1e98eefa7
@@ -27,7 +27,13 @@ Sockets.init = function (server) {
|
||||
path: nconf.get('relative_path') + '/socket.io',
|
||||
});
|
||||
|
||||
io.adapter(nconf.get('redis') ? require('../database/redis').socketAdapter() : db.socketAdapter());
|
||||
if (nconf.get('singleHostCluster')) {
|
||||
io.adapter(require('socket.io-adapter-cluster')());
|
||||
} else if (nconf.get('redis')) {
|
||||
io.adapter(require('../database/redis').socketAdapter());
|
||||
} else {
|
||||
io.adapter(db.socketAdapter());
|
||||
}
|
||||
|
||||
io.use(socketioWildcard);
|
||||
io.use(authorize);
|
||||
|
||||
Reference in New Issue
Block a user