Sfoglia il codice sorgente

Handle "not connected" errors

James 11 anni fa
parent
commit
ca6cfb1608
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      stream-server.js

+ 4 - 1
stream-server.js Vedi File

35
 
35
 
36
 socketServer.broadcast = function(data, opts) {
36
 socketServer.broadcast = function(data, opts) {
37
 	for( var i in this.clients ) {
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
+		else
41
+			this.emit("error", "not connected");
39
 	}
42
 	}
40
 };
43
 };
41
 
44