aboutsummaryrefslogtreecommitdiff
path: root/public/main.js
blob: b3c79867fba186c0fbdc9cdbeba0612f6c1becd0 (plain)
1
2
3
4
5
6
7
8
9
10
document.addEventListener("DOMContentLoaded", async () => { "use strict"

const $ = s => document.querySelector(s);
const secure = location.protocol === "https:";
const sock = new WebSocket(`ws${secure?"s":""}://${location.host}/ws`);

sock.onmessage = e => console.log("sock", e);
sock.onopen = () => sock.send("yay");

});