From a3cd39dd5c6c70dd09c174297ac41c56256f4a3e Mon Sep 17 00:00:00 2001 From: liamcottle Date: Mon, 29 Apr 2024 04:08:17 +1200 Subject: [PATCH] auto reconnect websocket when it gets disconnected --- index.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.html b/index.html index 7b70a29..403b6cd 100644 --- a/index.html +++ b/index.html @@ -140,6 +140,7 @@ return { isWebsocketConnected: false, + autoReconnectWebsocket: true, sendToDestinationHash: "bebfd1f0635a7f6129ee3b30c05328f3", @@ -166,6 +167,11 @@ this.ws.addEventListener('close', () => { this.isWebsocketConnected = false; + if(this.autoReconnectWebsocket){ + setTimeout(() => { + this.connectWebsocket(); + }, 1000); + } }); // handle data from reticulum