From b438437570ea561d3addc9cb32b4eb3c906414c1 Mon Sep 17 00:00:00 2001 From: takoserver <96359093+tako0614@users.noreply.github.com> Date: Wed, 19 Jun 2024 16:01:26 +0900 Subject: [PATCH] kishida --- islands/Chats/Chat.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/islands/Chats/Chat.tsx b/islands/Chats/Chat.tsx index 19d16a1e..39d1c529 100644 --- a/islands/Chats/Chat.tsx +++ b/islands/Chats/Chat.tsx @@ -99,7 +99,9 @@ export default function Home( } else { wssprotocol = "ws://" } - const wsurl = wssprotocol + "/api/v1/main" + const origin = window.location.origin; + const domain = (new URL(origin)).hostname; + const wsurl = wssprotocol + domain + "/api/v1/main" const socket = new WebSocket( wsurl )