aboutsummaryrefslogtreecommitdiff
path: root/public/main.js
blob: 46d54328670fe5e1ca1af9dbf5b439bf479ff6bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
document.addEventListener("DOMContentLoaded", async () => { "use strict"

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

sock.on("hello", e => {
  console.log("hello", e);
  sock.send("world", {foo:"bar"});
});

sock.on("yay", e => {
  console.log("yay", e);
});

});