Selects the datachannel that is ready for sending notifications to the bridge.

This commit is contained in:
George Politis 2014-10-02 19:11:55 +02:00
parent ca3c59f244
commit e74d27bf88
1 changed files with 14 additions and 6 deletions

20
app.js
View File

@ -1507,12 +1507,20 @@ $(document).bind('fatalError.jingle',
function onSelectedEndpointChanged(userJid)
{
console.log('selected endpoint changed: ', userJid);
if (_dataChannels && _dataChannels.length != 0 && _dataChannels[0].readyState == "open") {
_dataChannels[0].send(JSON.stringify({
'colibriClass': 'SelectedEndpointChangedEvent',
'selectedEndpoint': (!userJid || userJid == null)
? null : Strophe.getResourceFromJid(userJid)
}));
if (_dataChannels && _dataChannels.length != 0)
{
_dataChannels.some(function (dataChannel) {
if (dataChannel.readyState == 'open')
{
dataChannel.send(JSON.stringify({
'colibriClass': 'SelectedEndpointChangedEvent',
'selectedEndpoint': (!userJid || userJid == null)
? null : Strophe.getResourceFromJid(userJid)
}));
return true;
}
});
}
}