Skip to content

Commit

Permalink
Works with express 3.1.x.
Browse files Browse the repository at this point in the history
  • Loading branch information
bennlich committed Apr 15, 2013
1 parent 7dd4560 commit a1a187f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions lib/acequia.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function AcequiaServer(options) {
, tcpPort: 9092
, timeout: 600000
, express_app: null
, httpServer: null
, minify_client: true
, enableDiscovery: true
}, options || {});
Expand Down Expand Up @@ -254,17 +255,22 @@ AcequiaServer.prototype.createTCPServer = function () {
*/
AcequiaServer.prototype.createWSServer = function () {
var clientCode, io, app;

if (!clientCode) {
// Generate the client code
clientCode = require("./genclient").generateClientCode();
}

if (!this.options.express_app) {
this.options.express_app = express.createServer();
this.options.express_app.listen(this.options.wsPort);
}
this.options.express_app = express();
// this.options.express_app.listen(this.options.wsPort);
}
if (!this.options.httpServer) {
this.options.httpServer = http.createServer(this.options.express_app);
this.options.httpServer.listen(this.options.wsPort);
}
app = this.options.express_app;
httpServer = this.options.httpServer;

// Add the acequiaServer instance to the web app, so it has acess to its
// options
Expand Down Expand Up @@ -318,7 +324,7 @@ AcequiaServer.prototype.createWSServer = function () {
logger.debug(" WS Server is listening on [%s:%s]", this.address().address, this.address().port);
});

io = require('socket.io').listen(app);
io = require('socket.io').listen(httpServer);

io.configure(function () {
io.enable('browser client minification'); // send minified client
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
, "engines": { "node": ">=0.6" }
, "dependencies" :
{ "log4js" : ">=0.4.1"
, "express": "2.5.9"
, "express": "3.1.x"
, "socket.io": ">=0.9.6"
, "socket.io-client":">=0.9.6"
, "uglify-js": ">=1.2.5"
Expand Down

0 comments on commit a1a187f

Please sign in to comment.