From 73e043aa0db6a9c24de8bdffe8c7a0dec73ec3fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 7 Feb 2021 16:43:53 +0100 Subject: [PATCH] add reconnection logic. --- src/component/main.vue | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/component/main.vue b/src/component/main.vue index 25183d6f..201eb09c 100644 --- a/src/component/main.vue +++ b/src/component/main.vue @@ -341,6 +341,15 @@ this.webrtc.disconnect() this.clearState() + + // reconnect WebRTC + if (this.authenticated) { + setTimeout(() => { + try { + this.websocketConnect() + } catch (e) {} + }, 1000) + } }) // webrtc @@ -377,6 +386,7 @@ }) this.webrtc.on('disconnected', () => { Vue.set(this.state.connection, 'webrtc', 'disconnected') + Vue.set(this.state.connection, 'webrtc_stats', null) Vue.set(this.state.connection, 'type', 'none') this.events.emit('connection.webrtc', 'disconnected') @@ -389,6 +399,15 @@ // @ts-ignore this._video.removeAttribute('src') } + + // reconnect WebRTC + if (this.connected) { + setTimeout(() => { + try { + this.webrtcConnect() + } catch (e) {} + }, 1000) + } }) // check if is user logged in