Browse Source

Adds check for datachanel state before sending data.

master
hristoterezov 11 years ago
parent
commit
386e10a966
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      app.js

+ 1
- 1
app.js View File

1440
 function onSelectedEndpointChanged(userJid)
1440
 function onSelectedEndpointChanged(userJid)
1441
 {
1441
 {
1442
     console.log('selected endpoint changed: ', userJid);
1442
     console.log('selected endpoint changed: ', userJid);
1443
-    if (_dataChannels && _dataChannels.length != 0) {
1443
+    if (_dataChannels && _dataChannels.length != 0 && _dataChannels[0].readyState == "open") {
1444
         _dataChannels[0].send(JSON.stringify({
1444
         _dataChannels[0].send(JSON.stringify({
1445
             'colibriClass': 'SelectedEndpointChangedEvent',
1445
             'colibriClass': 'SelectedEndpointChangedEvent',
1446
             'selectedEndpoint': (!userJid || userJid == null)
1446
             'selectedEndpoint': (!userJid || userJid == null)

Loading…
Cancel
Save