Pārlūkot izejas kodu

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 gadus atpakaļ
vecāks
revīzija
b25db3ce2e
3 mainītis faili ar 14 papildinājumiem un 2 dzēšanām
  1. 3
    0
      config.js
  2. 9
    1
      connection.js
  3. 2
    1
      react/features/base/connection/actions.native.js

+ 3
- 0
config.js Parādīt failu

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

+ 9
- 1
connection.js Parādīt failu

@@ -75,7 +75,15 @@ function connect(id, password, roomName) {
75 75
     const connectionConfig = Object.assign({}, config);
76 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 88
     const connection
81 89
         = new JitsiMeetJS.JitsiConnection(

+ 2
- 1
react/features/base/connection/actions.native.js Parādīt failu

@@ -312,7 +312,8 @@ function _constructOptions(state) {
312 312
 
313 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 319
     return options;

Notiek ielāde…
Atcelt
Saglabāt