浏览代码

Adds check for datachanel state before sending data.

j8
hristoterezov 10 年前
父节点
当前提交
386e10a966
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1
    1
      app.js

+ 1
- 1
app.js 查看文件

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)

正在加载...
取消
保存