diff options
author | Adam Hovorka <[email protected]> | 2019-07-17 19:32:57 -0600 |
---|---|---|
committer | Adam Hovorka <[email protected]> | 2019-07-17 19:32:57 -0600 |
commit | 138ddfbed3746fe7cb03a1fcdc46fc610c098ec3 (patch) | |
tree | 3549e63ecea9b4d8d2c4e9d60271294ada2f50b1 /public | |
parent | 6bb3e72df331ef45a69fe7f76ed4b7e7babe021a (diff) |
Add basic WebSocket connection
Diffstat (limited to 'public')
-rw-r--r-- | public/main.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/public/main.js b/public/main.js index eae1d63..da4083e 100644 --- a/public/main.js +++ b/public/main.js @@ -1,7 +1,9 @@ document.addEventListener("DOMContentLoaded", async () => { "use strict" const $ = s => document.querySelector(s); +const sock = new WebSocket(`ws://${location.host}/ws`); -// TODO +sock.onmessage = e => console.log("sock", e); +sock.onopen = () => sock.send("yay"); }); |