hrtjji[erj[iogrst

This commit is contained in:
Arthur Beck 2025-04-11 18:30:05 +00:00
parent 3c0f77b7eb
commit b841e066b9

View file

@ -17,6 +17,11 @@ function log(...args) {
let wsurl = new URL(document.location.toString());
wsurl.port = 3000;
if (document.location.protocol == "http") {
wsurl.protocol = "ws";
} else {
wsurl.protocol = "wss";
}
let conn = new WebSocket(wsurl);
conn.onmessage = (ev) => {
@ -27,9 +32,10 @@ conn.onmessage = (ev) => {
newMsg.appendChild(messageContents);
document.getElementById("chat-body").appendChild(newMsg);
};
/**
* @type {HTMLInputElement}
*/
* @type {HTMLInputElement}
*/
let input = document.getElementById("chat-input");
input.onchange = (_) => {
conn.send(input.value.toString());