From e28b71409023b7f40534baa7b18f986e60eca2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Mon, 8 Feb 2021 22:32:54 +0100 Subject: [PATCH] webrtcReconnect. --- src/component/main.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/component/main.vue b/src/component/main.vue index 4a2cbff0..1a10861b 100644 --- a/src/component/main.vue +++ b/src/component/main.vue @@ -397,6 +397,8 @@ Vue.set(this.state.connection, 'type', 'webrtc') this.events.emit('connection.webrtc', 'connected') }) + + let webrtcReconnect: any this.webrtc.on('disconnected', () => { Vue.set(this.state.connection.webrtc, 'status', 'disconnected') Vue.set(this.state.connection.webrtc, 'stats', null) @@ -417,7 +419,9 @@ // reconnect WebRTC if (this.connected) { - setTimeout(() => { + if (webrtcReconnect) clearTimeout(webrtcReconnect) + + webrtcReconnect = setTimeout(() => { try { this.webrtcConnect() } catch (e) {}