working on client-server communication
[henge/kiak.git] / host.js
diff --git a/host.js b/host.js
index f70732b..dd48d10 100644 (file)
--- a/host.js
+++ b/host.js
@@ -9,6 +9,7 @@ if ("WebSocket" in window) {
     }
     wsock.onmessage = (msg) => {
       /* Message is offer from client */
+      /* TODO: Determine which client ?? */
       console.log("Incoming connection " + msg)
 
       /* TODO: State machine to parse offer */
@@ -23,15 +24,16 @@ if ("WebSocket" in window) {
       }).then(() => {
         const hpk = getPublicKey()
         wsock.send({
-          cmd: '< sdp pubKey'
-          sdp: hpc.localDescription
+          cmd: '< sdp pubKey',
+          sdp: hpc.localDescription,
           pubKey: hpk
         })
         clients.push({
-          host-sdp: hpc.localDescription,
-          client-sdp: hpc.remoteDescription,
+          hostsdp: hpc.localDescription,
+          clientsdp: hpc.remoteDescription,
           clientPubKey: msg.pubKey
         })
+
       })
     }
   })