浏览代码

feat(config.js): add 'websocket' config option

Config.js will allow to specify both BOSH and Websocket URLs. In such
case the web app will prefer Websocket over BOSH. The reason is that it
appears to be more stable and a bit fast on web, while on mobile
websocket is dropped fast(killed by the OS) on network changes.
j8
paweldomas 5 年前
父节点
当前提交
b25db3ce2e
共有 3 个文件被更改,包括 14 次插入2 次删除
  1. 3
    0
      config.js
  2. 9
    1
      connection.js
  3. 2
    1
      react/features/base/connection/actions.native.js

+ 3
- 0
config.js 查看文件

30
     // BOSH URL. FIXME: use XEP-0156 to discover it.
30
     // BOSH URL. FIXME: use XEP-0156 to discover it.
31
     bosh: '//jitsi-meet.example.com/http-bind',
31
     bosh: '//jitsi-meet.example.com/http-bind',
32
 
32
 
33
+    // Websocket URL
34
+    // websocket: 'wss://jitsi-meet.example.com/xmpp-websocket',
35
+
33
     // The name of client node advertised in XEP-0115 'c' stanza
36
     // The name of client node advertised in XEP-0115 'c' stanza
34
     clientNode: 'http://jitsi.org/jitsimeet',
37
     clientNode: 'http://jitsi.org/jitsimeet',
35
 
38
 

+ 9
- 1
connection.js 查看文件

75
     const connectionConfig = Object.assign({}, config);
75
     const connectionConfig = Object.assign({}, config);
76
     const { issuer, jwt } = APP.store.getState()['features/base/jwt'];
76
     const { issuer, jwt } = APP.store.getState()['features/base/jwt'];
77
 
77
 
78
-    connectionConfig.bosh += `?room=${roomName}`;
78
+    // Use Websocket URL for the web app if configured. Note that there is no 'isWeb' check, because there's assumption
79
+    // that this code executes only on web browsers/electron. This needs to be changed when mobile and web are unified.
80
+    let serviceUrl = connectionConfig.websocket || connectionConfig.bosh;
81
+
82
+    serviceUrl += `?room=${roomName}`;
83
+
84
+    // FIXME Remove deprecated 'bosh' option assignment at some point(LJM will be accepting only 'serviceUrl' option
85
+    //  in future). It's included for the time being for Jitsi Meet and lib-jitsi-meet versions interoperability.
86
+    connectionConfig.serviceUrl = connectionConfig.bosh = serviceUrl;
79
 
87
 
80
     const connection
88
     const connection
81
         = new JitsiMeetJS.JitsiConnection(
89
         = new JitsiMeetJS.JitsiConnection(

+ 2
- 1
react/features/base/connection/actions.native.js 查看文件

312
 
312
 
313
         room && (bosh += `?room=${getBackendSafeRoomName(room)}`);
313
         room && (bosh += `?room=${getBackendSafeRoomName(room)}`);
314
 
314
 
315
-        options.bosh = bosh;
315
+        // FIXME Remove deprecated 'bosh' option assignment at some point.
316
+        options.serviceUrl = options.bosh = bosh;
316
     }
317
     }
317
 
318
 
318
     return options;
319
     return options;

正在加载...
取消
保存