diff --git a/public/src/app.js b/public/src/app.js index ca8e156849..ab8da090df 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -78,6 +78,7 @@ var socket, var ioParams = { reconnectionAttempts: config.maxReconnectionAttempts, reconnectionDelay : config.reconnectionDelay, + transports: config.socketioTransports, path: RELATIVE_PATH + '/socket.io' }; diff --git a/src/controllers/api.js b/src/controllers/api.js index 90d8ee412e..b6b197ae3d 100644 --- a/src/controllers/api.js +++ b/src/controllers/api.js @@ -13,6 +13,7 @@ var apiController = {}; apiController.getConfig = function(req, res, next) { var config = {}; config.relative_path = nconf.get('relative_path'); + config.socketioTransports = nconf.get('socketioTransports') || ['websocket', 'polling']; config.version = pkg.version; config.siteTitle = meta.config.title || meta.config.browserTitle || 'NodeBB'; config.showSiteTitle = parseInt(meta.config.showSiteTitle, 10) === 1; diff --git a/src/socket.io/index.js b/src/socket.io/index.js index 2df9e3ead8..52fcfb2ee8 100644 --- a/src/socket.io/index.js +++ b/src/socket.io/index.js @@ -36,7 +36,7 @@ Sockets.init = function(server) { io.on('connection', onConnection); io.listen(server, { - transports: ['websocket', 'polling'] + transports: nconf.get('socketioTransports') || ['websocket', 'polling'] }); Sockets.server = io;