???
This commit is contained in:
@ -20,7 +20,10 @@ export default function Chat() {
|
||||
setUsername(`User${randomNum}`);
|
||||
}
|
||||
|
||||
const ws = new WebSocket(`ws://${globalThis.location.host}/api/chat`);
|
||||
const wsProtocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
||||
const ws = new WebSocket(
|
||||
`${wsProtocol}//${globalThis.location.host}/api/chat`,
|
||||
);
|
||||
|
||||
ws.onopen = () => {
|
||||
console.log("Connected to chat");
|
||||
|
Reference in New Issue
Block a user