Some tyhigns.

This commit is contained in:
2026-03-11 00:27:19 -04:00
parent 3b1b4f63e2
commit cbd2270628
14 changed files with 571 additions and 163 deletions

View File

@@ -27,14 +27,20 @@ import { renderChat } from "./render.js";
* @param {HTMLElement} chatEl - The container element for chat entries.
* @param {HTMLElement} inputContainer - The message input area element.
* @param {HTMLElement} usersListEl - The element displaying the online users.
* @param {string} wsDomain - Host (and optional port) for the WebSocket server.
* @returns {{ socket: WebSocket, sendMessage: (content: string) => void }}
*/
export function initWebSocket(username, chatEl, inputContainer, usersListEl) {
const socket = new WebSocket( //"ws://localhost:8080");
(location.protocol === "https:" ? "wss" : "ws") +
"://" +
location.host +
"/ws",
export function initWebSocket(
username,
chatEl,
inputContainer,
usersListEl,
wsDomain,
) {
const socket = new WebSocket(
`${location.protocol === "https:" ? "wss" : "ws"}://${
wsDomain || location.host
}/ws`,
"coms",
);