Created
June 13, 2022 03:21
-
-
Save rsatrio/ed9faab106285394d27d7e0f58668702 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rtcPeer.onicecandidate = event => { | |
console.log('Got ice candidate'); | |
if (event.candidate) { | |
console.log('ice candidate:' + JSON.stringify(event.candidate)); | |
signal1.userId = userId2; | |
signal1.type = 'Ice'; | |
signal1.data = JSON.stringify(event.candidate); | |
signal1.toUid = data1.userId; | |
} | |
console.log('ice candidate2:' + JSON.stringify(event)); | |
if (event.candidate) { | |
if (Object.keys(event.candidate.candidate).length > 1) { | |
console.log("Sending candidate to server"); | |
ws1.send(JSON.stringify(signal1)); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment