From fb3c28b6aa3b081739f102a4e725cc21c595f4ef Mon Sep 17 00:00:00 2001 From: Khush Jammu Date: Wed, 3 Jun 2020 17:44:05 +0800 Subject: [PATCH] add reloading for erronous disconnects --- public/js/chat.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/js/chat.js b/public/js/chat.js index 3404d46..4c41278 100644 --- a/public/js/chat.js +++ b/public/js/chat.js @@ -203,6 +203,12 @@ var VideoChat = { logIt("connected"); break; case "disconnected": + // First possibility: we disconnected from the peer + if (VideoChat.socket.connect().connected === false) { + location.reload(); + } + + // Second possibility: the peer disconnected from us logIt("disconnected - UUID " + uuid); VideoChat.remoteVideoWrapper.removeChild( document.querySelectorAll(`[uuid="${uuid}"]`)[0]