Some tyhigns.
This commit is contained in:
@@ -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",
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user