From 74cd7d586dc22f3b469ef134f35918c35b02fe43 Mon Sep 17 00:00:00 2001 From: patryk20120 Date: Wed, 15 May 2024 22:37:41 +0200 Subject: [PATCH] chore(ChatWindow): :wrench: add auto protocol --- ui/components/ChatWindow.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/components/ChatWindow.tsx b/ui/components/ChatWindow.tsx index 4ae1e56..7f051da 100644 --- a/ui/components/ChatWindow.tsx +++ b/ui/components/ChatWindow.tsx @@ -145,8 +145,8 @@ const ChatWindow = () => { const publicPort = typeof window !== 'undefined' && window.location.port; const publicUrl = `${publicHostname}${publicPort ? `:${publicPort}` : ''}`; const publicProtocol = typeof window !== 'undefined' && window.location.protocol; - const wsProtocol = publicProtocol === 'https:' ? 'wss:' : 'ws:'; - const webSocketUrl = process.env.NEXT_PUBLIC_WS_URL || `${wsProtocol}://${publicUrl}/ws`; + const wsProtocol = publicProtocol === 'https:' ? 'wss://' : 'ws://'; + const webSocketUrl = process.env.NEXT_PUBLIC_WS_URL || `${wsProtocol}${publicUrl}/ws`; const ws = useSocket(webSocketUrl, setIsReady); const [chatHistory, setChatHistory] = useState<[string, string][]>([]);