Permalink
Browse files

added message on someone's connection close

  • Loading branch information...
1 parent 627e9dc commit f66c7b82bd6cca541d979c8715a6852bd34e4c40 @agektmr agektmr committed Feb 29, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 server.js
View
@@ -82,11 +82,13 @@ app.listen(3000, function() {
}
})
ws.on('close', function() {
- console.log('listener closed the connection.');
+ console.log(name+' closed the connection.');
for (var i = 0; i < listeners.length; i++) {
if (listeners[i] == ws) {
listeners.splice(i, 1);
break;
+ } else {
+ listeners[i].send(name+' closed the connection.');
}
}
});

0 comments on commit f66c7b8

Please sign in to comment.