소스 검색

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