diff options
author | metamuffin <metamuffin@disroot.org> | 2025-05-18 17:05:55 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-05-18 17:05:55 +0200 |
commit | a723073738aa512514a9cb2f9826184a2507b709 (patch) | |
tree | e429f1c5507c26e5699242cc9ac5b15cda1079e7 | |
parent | 55b695813577023345967360bd56a353eaaf2908 (diff) | |
download | isda-a723073738aa512514a9cb2f9826184a2507b709.tar isda-a723073738aa512514a9cb2f9826184a2507b709.tar.bz2 isda-a723073738aa512514a9cb2f9826184a2507b709.tar.zst |
show warning on ws close
-rw-r--r-- | src/webui_live.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/webui_live.js b/src/webui_live.js index 12b5fef..b28fa52 100644 --- a/src/webui_live.js +++ b/src/webui_live.js @@ -2,8 +2,13 @@ const ws = new WebSocket("/webui_ws") ws.onopen = () => console.log("ws open"); -ws.onclose = () => console.warn("ws close"); ws.onerror = () => console.warn("ws error"); +ws.onclose = () => { + console.warn("ws close"); + document.body.innerHTML += + `<p style="position:absolute;top:10px;left:10px;font-size:larger;background-color:red;padding:1em;">Websocket connection lost.</p>` + setTimeout(() => globalThis.location.reload(), 500) +} ws.onmessage = ev => { const u = JSON.parse(ev.data) if (u.t == "update_worker") { |