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
//
autoload: true,
//
// Prefetch URLs
//
@ -170,6 +170,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);