From 4091f2c655f035444695be44d2c48da42a3c6170 Mon Sep 17 00:00:00 2001 From: Rustam Date: Mon, 18 Mar 2024 16:34:09 +0100 Subject: [PATCH] Fix WS URL --- frontend/src/lib/WebSocketNotifications.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/WebSocketNotifications.tsx b/frontend/src/lib/WebSocketNotifications.tsx index 2e4a527..e028e36 100644 --- a/frontend/src/lib/WebSocketNotifications.tsx +++ b/frontend/src/lib/WebSocketNotifications.tsx @@ -14,7 +14,8 @@ function Toast({ title, description }: { title: string; description: string }) { } export function WebSocketNotifications() { - const ws = useWebSocket('ws://localhost:8080/ws', { + const wsUrl = document.location.origin.replace(/^http/, 'ws') + '/ws' + const ws = useWebSocket(wsUrl, { onOpen: (e) => { console.log('Connected to server', e) toast.success(