summaryrefslogtreecommitdiff
path: root/src/node/hooks
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2012-09-21 17:12:22 +0200
committerMarcel Klehr <mklehr@gmx.net>2012-09-21 17:12:22 +0200
commit4416210471e1964d7c30babc354e0e03d1cc00ca (patch)
tree85b1a39740ad4e21d39c63d584668eab164c50ef /src/node/hooks
parentc8b6d3b4f3bb8677b259a8c5be2e9611004347c0 (diff)
downloadetherpad-lite-4416210471e1964d7c30babc354e0e03d1cc00ca.zip
Differentiate between http server and express app
Diffstat (limited to 'src/node/hooks')
-rw-r--r--src/node/hooks/express.js12
-rw-r--r--src/node/hooks/express/socketio.js4
2 files changed, 9 insertions, 7 deletions
diff --git a/src/node/hooks/express.js b/src/node/hooks/express.js
index e4ff40d9..eb3f6188 100644
--- a/src/node/hooks/express.js
+++ b/src/node/hooks/express.js
@@ -1,4 +1,5 @@
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
+var http = require('http');
var express = require('express');
var settings = require('../utils/Settings');
var fs = require('fs');
@@ -48,17 +49,18 @@ exports.restartServer = function () {
server.close();
}
- server = express(); // New syntax for express v3
+ var app = express(); // New syntax for express v3
+ server = http.createServer(app);
- server.use(function (req, res, next) {
+ app.use(function (req, res, next) {
res.header("Server", serverName);
next();
});
- server.configure(function() {
- hooks.callAll("expressConfigure", {"app": server});
+ app.configure(function() {
+ hooks.callAll("expressConfigure", {"app": app});
});
- hooks.callAll("expressCreateServer", {"app": server});
+ hooks.callAll("expressCreateServer", {"app": app, "server": server});
server.listen(settings.port, settings.ip);
}
diff --git a/src/node/hooks/express/socketio.js b/src/node/hooks/express/socketio.js
index 4f780cb0..9e1a010f 100644
--- a/src/node/hooks/express/socketio.js
+++ b/src/node/hooks/express/socketio.js
@@ -10,7 +10,7 @@ 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.app);
+ var io = socketio.listen(args.server);
/* Require an express session cookie to be present, and load the
* session. See http://www.danielbaulig.de/socket-ioexpress for more
@@ -62,5 +62,5 @@ exports.expressCreateServer = function (hook_name, args, cb) {
socketIORouter.setSocketIO(io);
socketIORouter.addComponent("pad", padMessageHandler);
- hooks.callAll("socketio", {"app": args.app, "io": io});
+ hooks.callAll("socketio", {"app": args.app, "io": io, "server": args.server});
}