getPublicKey().then((cpk) => {
console.log('Client: Create and send offer')
const cpc = new RTCPeerConnection(conf)
- /* Start data channel */
- dataChannel = cpc.createDataChannel("sendChannel");
- dataChannel.onmessage = (msg) => {
- console.log(msg.data)
- }
- dataChannel.onopen = () => {
- dataChannel.send(`Hi from the Client`)
- }
-
cpc.oniceconnectionstatechange = () => {
console.log('iceConnectionState = ' + cpc.iceConnectionState)
console.log('error in sdp handshake: ' + err)
})
}
+ /* Start data channel */
+ dataChannel = cpc.createDataChannel("sendChannel");
+ dataChannel.onmessage = (msg) => {
+ console.log(msg.data)
+ }
+ dataChannel.onopen = () => {
+ dataChannel.send(`Hi from the Client`)
+ }
+
})