diff --git a/config/socket.io.js b/config/socket.io.js index 443e1c2e..9500d538 100644 --- a/config/socket.io.js +++ b/config/socket.io.js @@ -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; -}; \ No newline at end of file +};