Skip to content

Commit

Permalink
Handle "not connected" errors
Browse files Browse the repository at this point in the history
  • Loading branch information
James-TR committed Jun 26, 2014
1 parent fa5b754 commit ca6cfb1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion stream-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ 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
this.emit("error", "not connected");
}
};

Expand Down

0 comments on commit ca6cfb1

Please sign in to comment.