aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json27
-rw-r--r--webcastor.js18
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 @@
6 "scripts": { 6 "scripts": {
7 "test": "echo \"Error: no test specified! Configure in package.json\" && exit 1" 7 "test": "echo \"Error: no test specified! Configure in package.json\" && exit 1"
8 }, 8 },
9 "repository": "", 9 "repository": "https://github.com/Pacien/Webcastor",
10 "keywords": [ 10 "author": "Pacien TRAN-GIRARD",
11 "node.js",
12 "eclipse",
13 "nodeclipse"
14 ],
15 "author": "",
16 "license": "MIT", 11 "license": "MIT",
17 "readmeFilename": "README.md", 12 "readmeFilename": "README.md",
18 "dependencies": { 13 "dependencies": {
19 "body-parser": "^1.1.1",
20 "express": "^4.1.2",
21 "hogan-express": "^0.5.2",
22 "http": "0.0.0", 14 "http": "0.0.0",
23 "logfmt": "^1.1.2", 15 "socket.io-wildcard": "~0.1.1",
24 "password-hash": "^1.2.2", 16 "password-hash": "~1.2.2",
25 "redis": "^0.10.1", 17 "redis": "~0.10.3",
26 "socket.io": "^0.9.16", 18 "url": "~0.10.1",
27 "socket.io-wildcard": "^0.1.1", 19 "body-parser": "~1.4.3",
28 "url": "^0.10.1" 20 "logfmt": "~1.1.2",
21 "hogan-express": "~0.5.2",
22 "express": "~4.5.0",
23 "socket.io": "~1.0.6"
29 }, 24 },
30 "engines": { 25 "engines": {
31 "node": "0.10.x" 26 "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 = {
25 hogan : require('hogan-express'), 25 hogan : require('hogan-express'),
26 26
27 socketio : require('socket.io'), 27 socketio : require('socket.io'),
28 socketioWildcard : require('socket.io-wildcard'),
29 28
30 redis : require('redis'), 29 redis : require('redis'),
31 30
@@ -34,8 +33,7 @@ var imports = {
34 33
35var params = { 34var params = {
36 database : { 35 database : {
37 persistent : process.env.REDISCLOUD_URL !== undefined 36 persistent : process.env.REDISCLOUD_URL !== undefined && process.env.REDISCLOUD_URL !== null,
38 && process.env.REDISCLOUD_URL !== null,
39 server : process.env.REDISCLOUD_URL, 37 server : process.env.REDISCLOUD_URL,
40 }, 38 },
41 39
@@ -106,8 +104,7 @@ var Server = {
106 104
107 this.app = this.createApp(); 105 this.app = this.createApp();
108 this.server = imports.http.createServer(this.app); 106 this.server = imports.http.createServer(this.app);
109 this.io = imports.socketioWildcard(imports.socketio) 107 this.io = imports.socketio.listen(this.server);
110 .listen(this.server);
111 108
112 this.addHandlers(this.app, this.io); 109 this.addHandlers(this.app, this.io);
113 110
@@ -183,15 +180,14 @@ var Server = {
183 180
184 socket.join(channel); 181 socket.join(channel);
185 182
186 if (!imports.passwordHash.verify(password, hashedPassword) 183 if (!imports.passwordHash.verify(password, hashedPassword) && hashedPassword !== 'none') {
187 && hashedPassword !== 'none') {
188 console.log('Client joined ' + channel); 184 console.log('Client joined ' + channel);
189 return; 185 return;
190 } 186 }
191 187
192 console.log('Broadcaster joined ' + channel); 188 console.log('Broadcaster joined ' + channel);
193 189
194 socket.on('*', function(event) { 190 socket.on('message', function(event) {
195 Server.broadcast(socket, channel, event); 191 Server.broadcast(socket, channel, event);
196 }); 192 });
197 }); 193 });
@@ -202,13 +198,11 @@ var Server = {
202 198
203 var messageSize = encodeURI(JSONmessage).split(/%..|./).length - 1; 199 var messageSize = encodeURI(JSONmessage).split(/%..|./).length - 1;
204 if (messageSize > params.messageSizeLimit) { 200 if (messageSize > params.messageSizeLimit) {
205 console.log('Not broadcasting ' + JSONmessage + ' (' + messageSize 201 console.log('Not broadcasting ' + JSONmessage + ' (' + messageSize + ' bytes)');
206 + ' bytes)');
207 return; 202 return;
208 } 203 }
209 204
210 console.log('Broadcasting ' + JSONmessage + ' (' + messageSize 205 console.log('Broadcasting ' + JSONmessage + ' (' + messageSize + ' bytes)');
211 + ' bytes)');
212 socket.broadcast.to(channel).emit(event.name, event.args); 206 socket.broadcast.to(channel).emit(event.name, event.args);
213 }, 207 },
214}; 208};