From dd01650584f3684aa08f3c694268aab5f78e913d Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Sun, 6 Jul 2014 00:27:50 +0200 Subject: Update dependencies, drop unsupported socket.io-wildcard --- package.json | 27 +++++++++++---------------- webcastor.js | 18 ++++++------------ 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index da6dad6..6a03a7f 100644 --- a/package.json +++ b/package.json @@ -6,26 +6,21 @@ "scripts": { "test": "echo \"Error: no test specified! Configure in package.json\" && exit 1" }, - "repository": "", - "keywords": [ - "node.js", - "eclipse", - "nodeclipse" - ], - "author": "", + "repository": "https://github.com/Pacien/Webcastor", + "author": "Pacien TRAN-GIRARD", "license": "MIT", "readmeFilename": "README.md", "dependencies": { - "body-parser": "^1.1.1", - "express": "^4.1.2", - "hogan-express": "^0.5.2", "http": "0.0.0", - "logfmt": "^1.1.2", - "password-hash": "^1.2.2", - "redis": "^0.10.1", - "socket.io": "^0.9.16", - "socket.io-wildcard": "^0.1.1", - "url": "^0.10.1" + "socket.io-wildcard": "~0.1.1", + "password-hash": "~1.2.2", + "redis": "~0.10.3", + "url": "~0.10.1", + "body-parser": "~1.4.3", + "logfmt": "~1.1.2", + "hogan-express": "~0.5.2", + "express": "~4.5.0", + "socket.io": "~1.0.6" }, "engines": { "node": "0.10.x" diff --git a/webcastor.js b/webcastor.js index b652854..deff3bf 100644 --- a/webcastor.js +++ b/webcastor.js @@ -25,7 +25,6 @@ var imports = { hogan : require('hogan-express'), socketio : require('socket.io'), - socketioWildcard : require('socket.io-wildcard'), redis : require('redis'), @@ -34,8 +33,7 @@ var imports = { var params = { database : { - persistent : process.env.REDISCLOUD_URL !== undefined - && process.env.REDISCLOUD_URL !== null, + persistent : process.env.REDISCLOUD_URL !== undefined && process.env.REDISCLOUD_URL !== null, server : process.env.REDISCLOUD_URL, }, @@ -106,8 +104,7 @@ var Server = { this.app = this.createApp(); this.server = imports.http.createServer(this.app); - this.io = imports.socketioWildcard(imports.socketio) - .listen(this.server); + this.io = imports.socketio.listen(this.server); this.addHandlers(this.app, this.io); @@ -183,15 +180,14 @@ var Server = { socket.join(channel); - if (!imports.passwordHash.verify(password, hashedPassword) - && hashedPassword !== 'none') { + if (!imports.passwordHash.verify(password, hashedPassword) && hashedPassword !== 'none') { console.log('Client joined ' + channel); return; } console.log('Broadcaster joined ' + channel); - socket.on('*', function(event) { + socket.on('message', function(event) { Server.broadcast(socket, channel, event); }); }); @@ -202,13 +198,11 @@ var Server = { var messageSize = encodeURI(JSONmessage).split(/%..|./).length - 1; if (messageSize > params.messageSizeLimit) { - console.log('Not broadcasting ' + JSONmessage + ' (' + messageSize - + ' bytes)'); + console.log('Not broadcasting ' + JSONmessage + ' (' + messageSize + ' bytes)'); return; } - console.log('Broadcasting ' + JSONmessage + ' (' + messageSize - + ' bytes)'); + console.log('Broadcasting ' + JSONmessage + ' (' + messageSize + ' bytes)'); socket.broadcast.to(channel).emit(event.name, event.args); }, }; -- cgit v1.2.3