/* Poll server for ice candidates until ice is complete */
function pollServerForICECandidate(cpc) {
window.setInterval(() => {
- if (cpc.iceGatheringState !== 'complete') {
+ if (cpc.iceGatheringState.localeCompare('complete') === 0) {
return new Promise((resolve, reject) => {
console.log('Client: Requesting ICE Candidates from server')
const request = new XMLHttpRequest()
}
request.send(cpc.pubKey)
}).then((response) => {
+ console.log('Client: Adding Ice Candidate ')
cpc.addIceCandidate(response.candidate)
}).catch((err) => {
console.log('pollServerForICECandidate: ' + err)