Skip to content

Commit

Permalink
Merge pull request phoboslab#15 from cassa/master
Browse files Browse the repository at this point in the history
Handle "not connected" errors
  • Loading branch information
phoboslab committed Jul 20, 2014
2 parents 3523b9a + c44a9fb commit 295bdb6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion stream-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ socketServer.on('connection', function(socket) {

socketServer.broadcast = function(data, opts) {
for( var i in this.clients ) {
this.clients[i].send(data, opts);
if (this.clients[i].readyState == 1) {
this.clients[i].send(data, opts);
}
else {
console.log( 'Error: Client ('+i+') not connected.' );
}
}
};

Expand Down

0 comments on commit 295bdb6

Please sign in to comment.