From 8e99d4fa14afc562c969e5fac5c44e97ca4dff29 Mon Sep 17 00:00:00 2001 From: Zhongheng Liu Date: Thu, 21 Dec 2023 19:38:01 +0200 Subject: [PATCH] dynamic websockets url resolve --- src/Chat/Chat.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Chat/Chat.tsx b/src/Chat/Chat.tsx index 080ea71..6f1d0a8 100644 --- a/src/Chat/Chat.tsx +++ b/src/Chat/Chat.tsx @@ -3,7 +3,7 @@ import { Message } from "./Message"; import { Client, Stomp } from "@stomp/stompjs"; import { MessageType } from "./types"; import { renderToStaticMarkup } from 'react-dom/server'; -const domain = "localhost" +const domain = window.location.hostname const port = "8080" const connectionAddress = `ws://${domain}:${port}/ws` const ChatWrapper = (