chore(ChatWindow): 🔧 add auto protocol
This commit is contained in:
parent
5b98be1644
commit
a8f5d4d50b
1 changed files with 3 additions and 1 deletions
|
@ -144,7 +144,9 @@ const ChatWindow = () => {
|
|||
const publicHostname = typeof window !== 'undefined' && window.location.hostname;
|
||||
const publicPort = typeof window !== 'undefined' && window.location.port;
|
||||
const publicUrl = `${publicHostname}${publicPort ? `:${publicPort}` : ''}`;
|
||||
const webSocketUrl = process.env.NEXT_PUBLIC_WS_URL || `ws://${publicUrl}/ws`;
|
||||
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 ws = useSocket(webSocketUrl, setIsReady);
|
||||
|
||||
const [chatHistory, setChatHistory] = useState<[string, string][]>([]);
|
||||
|
|
Loading…
Add table
Reference in a new issue