From 088d78d762f80920266698d9b258e00dd106106b Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Wed, 18 May 2022 13:39:20 -0500 Subject: [PATCH] Try fixing ws --- resources/event.js | 5 +++++ templates/chat/chat.html | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/event.js b/resources/event.js index 170940b..46583ec 100644 --- a/resources/event.js +++ b/resources/event.js @@ -60,6 +60,11 @@ function EventReceiver(websocket, poller, channels, last_msg, onmessage) { this.websocket.onclose = function (event) { if (event.code != 1000 && receiver.onwsclose !== null) receiver.onwsclose(event); + if (event.code == 1006) { + setTimeout(function() { + connect(); + }, 1000); + } } } else { this.websocket = null; diff --git a/templates/chat/chat.html b/templates/chat/chat.html index 3a1d631..f9cd626 100644 --- a/templates/chat/chat.html +++ b/templates/chat/chat.html @@ -115,7 +115,7 @@ let META_HEADER = [ console.log('Navigated away'); return; } - console.log('You probably should refresh?'); + console.log('Refreshing ws'); }; return receiver;