Adds check for datachanel state before sending data.

This commit is contained in:
hristoterezov 2014-09-19 16:19:55 +03:00
parent 1ac3571fdf
commit 386e10a966
1 changed files with 1 additions and 1 deletions

2
app.js
View File

@ -1440,7 +1440,7 @@ $(document).bind('fatalError.jingle',
function onSelectedEndpointChanged(userJid)
{
console.log('selected endpoint changed: ', userJid);
if (_dataChannels && _dataChannels.length != 0) {
if (_dataChannels && _dataChannels.length != 0 && _dataChannels[0].readyState == "open") {
_dataChannels[0].send(JSON.stringify({
'colibriClass': 'SelectedEndpointChangedEvent',
'selectedEndpoint': (!userJid || userJid == null)