Browse Source

feat(rn,connection) enable XMPP WebSocket on mobile

Co-authored-by: Saúl Ibarra Corretgé <saghul@jitsi.org>
master
paweldomas 4 years ago
parent
commit
663752be2c

+ 1
- 3
connection.js View File

@@ -106,9 +106,7 @@ export async function connect(id, password, roomName) {
106 106
 
107 107
     serviceUrl += `?room=${roomName}`;
108 108
 
109
-    // FIXME Remove deprecated 'bosh' option assignment at some point(LJM will be accepting only 'serviceUrl' option
110
-    //  in future). It's included for the time being for Jitsi Meet and lib-jitsi-meet versions interoperability.
111
-    connectionConfig.serviceUrl = connectionConfig.bosh = serviceUrl;
109
+    connectionConfig.serviceUrl = serviceUrl;
112 110
 
113 111
     if (connectionConfig.websocketKeepAliveUrl) {
114 112
         connectionConfig.websocketKeepAliveUrl += `?room=${roomName}`;

+ 1
- 1
react/features/analytics/functions.js View File

@@ -181,7 +181,7 @@ export function initAnalytics({ getState }: { getState: Function }, handlers: Ar
181 181
     permanentProperties.appName = getAppName();
182 182
 
183 183
     // Report if user is using websocket
184
-    permanentProperties.websocket = navigator.product !== 'ReactNative' && typeof config.websocket === 'string';
184
+    permanentProperties.websocket = typeof config.websocket === 'string';
185 185
 
186 186
     // Report if user is using the external API
187 187
     permanentProperties.externalApi = typeof API_ID === 'number';

+ 16
- 7
react/features/base/connection/actions.native.js View File

@@ -275,10 +275,11 @@ function _constructOptions(state) {
275 275
     // redux store.
276 276
     const options = _.cloneDeep(state['features/base/config']);
277 277
 
278
-    // Normalize the BOSH URL.
279 278
     let { bosh } = options;
279
+    const { websocket } = options;
280 280
 
281
-    if (bosh) {
281
+    // Normalize the BOSH URL.
282
+    if (bosh && !websocket) {
282 283
         const { locationURL } = state['features/base/connection'];
283 284
 
284 285
         if (bosh.startsWith('//')) {
@@ -295,14 +296,22 @@ function _constructOptions(state) {
295 296
             // eslint-disable-next-line max-len
296 297
             bosh = `${protocol}//${host}${contextRoot || '/'}${bosh.substr(1)}`;
297 298
         }
299
+    }
298 300
 
299
-        // Append room to the URL's search.
300
-        const { room } = state['features/base/conference'];
301
+    // WebSocket is preferred over BOSH.
302
+    const serviceUrl = websocket || bosh;
301 303
 
302
-        room && (bosh += `?room=${getBackendSafeRoomName(room)}`);
304
+    // Append room to the URL's search.
305
+    const { room } = state['features/base/conference'];
303 306
 
304
-        // FIXME Remove deprecated 'bosh' option assignment at some point.
305
-        options.serviceUrl = options.bosh = bosh;
307
+    if (serviceUrl && room) {
308
+        const roomName = getBackendSafeRoomName(room);
309
+
310
+        options.serviceUrl = `${serviceUrl}?room=${roomName}`;
311
+
312
+        if (options.websocketKeepAliveUrl) {
313
+            options.websocketKeepAliveUrl += `?room=${roomName}`;
314
+        }
306 315
     }
307 316
 
308 317
     return options;

Loading…
Cancel
Save