Merge pull request #267 from rikukissa/master

Add socket.io transports to configuration
This commit is contained in:
Mattias Erming 2014-11-05 23:41:55 +01:00
commit ac6aeaeba2
2 changed files with 14 additions and 3 deletions

View File

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

View File

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