- getPublicKey().then((hpk) => {\r
- hpc['hpk'] = hpk\r
- hpc.onicecandidate = (event) => {\r
- if (event.candidate) {\r
- console.log('Host: Allocating ice candidate for client')\r
- iceCandidates.push(JSON.stringify({\r
- cmd: "< ice pubKey",\r
- ice: event.candidate,\r
- hostPubKey: hpk.n, /* TODO: do we need to send this? */\r
- clientPubKey: offer.pubKey,\r
- iceState: "a"\r
- }))\r
- }\r
- else {\r
- console.log('Host: Finished sending ICE candidates')\r
- }\r
- }\r
- console.log('Host: Sending answer to Client ')\r
- wsock.send(JSON.stringify({\r
- cmd: '< sdp pubKey',\r
- sdp: hpc.localDescription,\r
- hostPubKey: hpk.n,\r
- clientPubKey: offer.pubKey\r
- }))\r