Explorar el Código

Merge pull request #15 from cassa/master

Dominic Szablewski hace 11 años
padre
commit
295bdb6857
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  1. 6 1
      stream-server.js

+ 6 - 1
stream-server.js Ver fichero

@@ -35,7 +35,12 @@ socketServer.on('connection', function(socket) {
35 35
 
36 36
 socketServer.broadcast = function(data, opts) {
37 37
 	for( var i in this.clients ) {
38
-		this.clients[i].send(data, opts);
38
+		if (this.clients[i].readyState == 1) {
39
+			this.clients[i].send(data, opts);
40
+		}
41
+		else {
42
+			console.log( 'Error: Client ('+i+') not connected.' );
43
+		}
39 44
 	}
40 45
 };
41 46