From 2ae20cdac1c7b388d677092c0f4b3adc24f3789c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20T=C3=B8n=20L=C3=B8vhaug?= Date: Fri, 10 Jan 2025 14:04:09 +0100 Subject: [PATCH] Close previous connection --- frontend/src/components/Container.svelte | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/components/Container.svelte b/frontend/src/components/Container.svelte index 5efd5f1..ec47afa 100644 --- a/frontend/src/components/Container.svelte +++ b/frontend/src/components/Container.svelte @@ -17,6 +17,10 @@ let debounce: number | null = $state(null); const connect = () => { + if (ws) { + ws.close(); + } + ws = new WebSocket("/ws"); ws.onmessage = (event) => {