Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Fix websocket reconnection (#3959)

embrac8b31e24e16
diff --git a/web/services/websocket-service.ts b/web/services/websocket-service.ts
index e2d73842f7..105f8a2b61 100644
--- a/web/services/websocket-service.ts
+++ b/web/services/websocket-service.ts
@@ -56,7 +56,7 @@ export default class WebsocketService {
const ws = new WebSocket(url.toString());
ws.onopen = this.onOpen.bind(this);
- ws.onerror = this.onError.bind(this);
+ ws.onclose = this.onClose.bind(this);
ws.onmessage = this.onMessage.bind(this);
this.websocket = ws;
@@ -70,12 +70,10 @@ export default class WebsocketService {
this.backOff = 0;
}
- // On ws error just close the socket and let it re-connect again for now.
- onError() {
- handleNetworkingError();
- this.socketDisconnected();
- this.websocket.close();
+ onClose() {
if (!this.isShutdown) {
+ handleNetworkingError();
+ this.socketDisconnected();
this.scheduleReconnect();
}
}