summaryrefslogtreecommitdiff
path: root/public/main.js
blob: 8df390aaeb72de35fd2e289dc45419b351beeaa8 (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);
});

});