host
authorken <ken@mihrtec.com>
Wed, 28 Jun 2017 07:18:11 +0000 (00:18 -0700)
committerken <ken@mihrtec.com>
Wed, 28 Jun 2017 07:18:11 +0000 (00:18 -0700)
host.js

diff --git a/host.js b/host.js
index 95d3cc6..45ea63f 100644 (file)
--- a/host.js
+++ b/host.js
@@ -1,21 +1,19 @@
 document.title = "Strapp.io Host"
 const clients = []
 if ("WebSocket" in window) {
-  document.addEventListener('DOMContentLoaded', (event) => {
-    const wsock = new WebSocket(`${_strapp_protocol}://${window.location.hostname}:${_strapp_port}`)
-    wsock.onopen = () => {
-      console.log(`Strapped to ${_strapp_protocol}://${window.location.hostname}:${_strapp_port}`)
-    }
-    wsock.onmessage = (evt) => {
-      console.log("Incoming connection from " + evt.data)
-      console.log("TODO: Open a socket to this client")
-      wsock.send("Got " + evt.data)
-      clients.push({
-       ip: evt.data,
-       dataChannel: undefined
-      })
-    }
-  })
+  const wsock = new WebSocket(`${_strapp_protocol}://${window.location.hostname}:${_strapp_port}`)
+  wsock.onopen = () => {
+    console.log(`Strapped to ${_strapp_protocol}://${window.location.hostname}:${_strapp_port}`)
+  }
+  wsock.onmessage = (evt) => {
+    console.log("Incoming connection from " + evt.data)
+    console.log("TODO: Open a socket to this client")
+    wsock.send("Got " + evt.data)
+    clients.push({
+      ip: evt.data,
+      dataChannel: undefined
+    })
+  }
 }
 else {
   document.addEventListener('DOMContentLoaded', () => {