Stuff & things.

This commit is contained in:
2026-02-14 22:10:43 -05:00
parent 22f62844e4
commit 766510132b
3 changed files with 20 additions and 6 deletions

View File

@@ -28,7 +28,13 @@ import { renderChat } from "./render.js";
* @returns {{ socket: WebSocket, sendMessage: (content: string) => void }}
*/
export function initWebSocket(username, chatEl, inputContainer, usersListEl) {
const socket = new WebSocket("ws://localhost:8080", "coms");
const socket = new WebSocket(
(location.protocol === "https:" ? "wss" : "ws") +
"://" +
location.host +
"/ws",
"coms",
);
socket.onopen = () => {
// Announce join.