Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(rn,connection) enable XMPP WebSocket on mobile

paweldomas663752be2ceb
diff --git a/connection.js b/connection.js
index 1f8bd1df58..f4fadd5c12 100644
--- a/connection.js
+++ b/connection.js
@@ -106,9 +106,7 @@ export async function connect(id, password, roomName) {
serviceUrl += `?room=${roomName}`;
- // FIXME Remove deprecated 'bosh' option assignment at some point(LJM will be accepting only 'serviceUrl' option
- // in future). It's included for the time being for Jitsi Meet and lib-jitsi-meet versions interoperability.
- connectionConfig.serviceUrl = connectionConfig.bosh = serviceUrl;
+ connectionConfig.serviceUrl = serviceUrl;
if (connectionConfig.websocketKeepAliveUrl) {
connectionConfig.websocketKeepAliveUrl += `?room=${roomName}`;
diff --git a/react/features/analytics/functions.js b/react/features/analytics/functions.js
index d15f841e83..2769e77ade 100644
--- a/react/features/analytics/functions.js
+++ b/react/features/analytics/functions.js
@@ -181,7 +181,7 @@ export function initAnalytics({ getState }: { getState: Function }, handlers: Ar
permanentProperties.appName = getAppName();
// Report if user is using websocket
- permanentProperties.websocket = navigator.product !== 'ReactNative' && typeof config.websocket === 'string';
+ permanentProperties.websocket = typeof config.websocket === 'string';
// Report if user is using the external API
permanentProperties.externalApi = typeof API_ID === 'number';
diff --git a/react/features/base/connection/actions.native.js b/react/features/base/connection/actions.native.js
index e227dbb75e..0f6c50ac28 100644
--- a/react/features/base/connection/actions.native.js
+++ b/react/features/base/connection/actions.native.js
@@ -275,10 +275,11 @@ function _constructOptions(state) {
// redux store.
const options = _.cloneDeep(state['features/base/config']);
- // Normalize the BOSH URL.
let { bosh } = options;
+ const { websocket } = options;
- if (bosh) {
+ // Normalize the BOSH URL.
+ if (bosh && !websocket) {
const { locationURL } = state['features/base/connection'];
if (bosh.startsWith('//')) {
@@ -295,14 +296,22 @@ function _constructOptions(state) {
// eslint-disable-next-line max-len
bosh = `${protocol}//${host}${contextRoot || '/'}${bosh.substr(1)}`;
}
+ }
- // Append room to the URL's search.
- const { room } = state['features/base/conference'];
+ // WebSocket is preferred over BOSH.
+ const serviceUrl = websocket || bosh;
- room && (bosh += `?room=${getBackendSafeRoomName(room)}`);
+ // Append room to the URL's search.
+ const { room } = state['features/base/conference'];
- // FIXME Remove deprecated 'bosh' option assignment at some point.
- options.serviceUrl = options.bosh = bosh;
+ if (serviceUrl && room) {
+ const roomName = getBackendSafeRoomName(room);
+
+ options.serviceUrl = `${serviceUrl}?room=${roomName}`;
+
+ if (options.websocketKeepAliveUrl) {
+ options.websocketKeepAliveUrl += `?room=${roomName}`;
+ }
}
return options;