ソースを参照

Handle "not connected" errors

James 11 年 前
コミット
ca6cfb1608
共有1 個のファイルを変更した4 個の追加1 個の削除を含む
  1. 4 1
      stream-server.js

+ 4 - 1
stream-server.js ファイルの表示

@@ -35,7 +35,10 @@ 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
+		else
41
+			this.emit("error", "not connected");
39 42
 	}
40 43
 };
41 44