Update socket.io.js
This commit is contained in:
parent
4d6a337e45
commit
08c7bc19e9
|
@ -13,7 +13,12 @@ module.exports = function (app, db) {
|
|||
|
||||
if(config.enableClusterMode){
|
||||
var redis = require('socket.io-redis');
|
||||
io.adapter(redis( process.env.REDIS_URL || { host: process.env.REDIS_DB_PORT_6379_TCP_ADDR || '127.0.0.1' , port: process.env.REDIS_DB_PORT_6379_TCP_PORT || 6379 }));
|
||||
if( process.env.REDIS_DB_PORT_6379_TCP_ADDR ){
|
||||
io.adapter(redis({ host: process.env.REDIS_DB_PORT_6379_TCP_ADDR || '127.0.0.1' , port: process.env.REDIS_DB_PORT_6379_TCP_PORT || 6379 }));
|
||||
|
||||
} else {
|
||||
io.adapter(redis( config.redisUrl ));
|
||||
}
|
||||
}
|
||||
// Add an event listener to the 'connection' event
|
||||
io.on('connection', function (socket) {
|
||||
|
@ -23,4 +28,4 @@ module.exports = function (app, db) {
|
|||
});
|
||||
|
||||
return server;
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue