add socket.io transports to configuration

This commit is contained in:
Riku Rouvila 2014-11-01 22:06:01 +02:00
parent c83a9d953a
commit 9416c492dd
2 changed files with 14 additions and 3 deletions

View File

@ -52,7 +52,7 @@ module.exports = {
// @default true
//
autoload: true,
//
// Prefetch URLs
//
@ -162,6 +162,13 @@ module.exports = {
//
join: "#foo, #shout-irc"
},
//
// Set socket.io transports
//
// @type array
// @default ['polling', 'websocket']
//
transports: ['polling', 'websocket']
//
// Run Shout with HTTPS support.

View File

@ -18,7 +18,7 @@ module.exports = function(options) {
var app = express()
.use(index)
.use(express.static("client"));
app.enable("trust proxy");
var server = null;
@ -26,6 +26,7 @@ module.exports = function(options) {
var protocol = https.enable ? "https" : "http";
var port = config.port;
var host = config.host;
var transports = config.transports || ['websocket', 'polling'];
if (!https.enable){
server = require("http");
@ -42,7 +43,10 @@ module.exports = function(options) {
require("./identd").start(config.identd.port);
}
sockets = io(server);
sockets = io(server, {
transports: transports
});
sockets.on("connect", function(socket) {
if (config.public) {
auth.call(socket);