Fix rare error with ws.close()

This commit is contained in:
Alexey Khit
2023-08-04 16:31:13 +04:00
parent 9c5ae3260c
commit 4baa3f5588
+4
View File
@@ -551,14 +551,18 @@ export class VideoRTC extends HTMLElement {
this.pcState = WebSocket.OPEN; this.pcState = WebSocket.OPEN;
this.wsState = WebSocket.CLOSED; this.wsState = WebSocket.CLOSED;
if (this.ws) {
this.ws.close(); this.ws.close();
this.ws = null; this.ws = null;
}
} else { } else {
this.pcState = WebSocket.CLOSED; this.pcState = WebSocket.CLOSED;
if (this.pc) {
this.pc.close(); this.pc.close();
this.pc = null; this.pc = null;
} }
} }
}
video2.srcObject = null; video2.srcObject = null;
} }