failover for certs and keys
[henge/kiak.git] / host.js
1 document.title = "Strapp.io Host"
2 const clients = []
3 if ("WebSocket" in window) {
4 document.addEventListener('DOMContentLoaded', (event) => {
5 const wsock = new WebSocket("wss://" + window.location.host + ":" + _strapp_port)
6 wsock.onopen = () => {
7 console.log("Strapped to wss://" + window.location.host + ":" + _strapp_port)
8 }
9 wsock.onmessage = (evt) => {
10 console.log("Incoming connection from " + evt.data)
11 console.log("TODO: Open a socket to this client")
12 wsock.send("Got " + evt.data)
13 clients.push({
14 ip: evt.data,
15 dataChannel: undefined
16 })
17 }
18 })
19 }
20 else {
21 document.addEventListener('DOMContentLoaded', () => {
22 document.body.innerHTML = 'Websockets not supported in your browser'
23 })
24 }