summaryrefslogtreecommitdiff
path: root/src/node/hooks
diff options
context:
space:
mode:
authorluto <m@luto.at>2014-11-25 22:38:22 +0100
committerluto <m@luto.at>2014-11-25 22:38:22 +0100
commit5c3874c0a1305b57fbf301850de12255cec2a0a0 (patch)
treec44b1d80861e8e540be129c99807428503324e21 /src/node/hooks
parent97068b562dce9525fda9fb7a08f54faf9ef2837d (diff)
downloadetherpad-lite-5c3874c0a1305b57fbf301850de12255cec2a0a0.zip
really recreate socketio-client in expressCreateServer, fixes #2342
When using plugins, the express server gets restarted. When we do that, the socketio-server should also get restarted. It doesn't. That means that all the events in SocketIORouter.js are bound twice, which causes chaos all over etherpad. This changes our socketio.js so it fully recreates the io-instance when we restart the server. introduced in 95e7b0f15609fc850b71717a672abd02237a0f33, but catching that would have been hard.
Diffstat (limited to 'src/node/hooks')
-rw-r--r--src/node/hooks/express/socketio.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/node/hooks/express/socketio.js b/src/node/hooks/express/socketio.js
index e88a3f4c..adf15212 100644
--- a/src/node/hooks/express/socketio.js
+++ b/src/node/hooks/express/socketio.js
@@ -1,24 +1,22 @@
var log4js = require('log4js');
var settings = require('../../utils/Settings');
+var socketio = require('socket.io');
var socketIORouter = require("../../handler/SocketIORouter");
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
var webaccess = require("ep_etherpad-lite/node/hooks/express/webaccess");
-// there shouldn't be a browser that isn't compatible to all
-// transports in this list at once
-// e.g. XHR is disabled in IE by default, so in IE it should use jsonp-polling
-
-var socketio = require('socket.io')({
- transports: settings.socketTransportProtocols
-});
-
var padMessageHandler = require("../../handler/PadMessageHandler");
var connect = require('connect');
exports.expressCreateServer = function (hook_name, args, cb) {
//init socket.io and redirect all requests to the MessageHandler
- var io = socketio.listen(args.server);
+ // there shouldn't be a browser that isn't compatible to all
+ // transports in this list at once
+ // e.g. XHR is disabled in IE by default, so in IE it should use jsonp-polling
+ var io = socketio({
+ transports: settings.socketTransportProtocols
+ }).listen(args.server);
/* Require an express session cookie to be present, and load the
* session. See http://www.danielbaulig.de/socket-ioexpress for more