feat(rn,connection) enable XMPP WebSocket on mobile
Co-authored-by: Saúl Ibarra Corretgé <saghul@jitsi.org>
This commit is contained in:
parent
380ef3da0b
commit
663752be2c
|
@ -106,9 +106,7 @@ export async function connect(id, password, roomName) {
|
||||||
|
|
||||||
serviceUrl += `?room=${roomName}`;
|
serviceUrl += `?room=${roomName}`;
|
||||||
|
|
||||||
// FIXME Remove deprecated 'bosh' option assignment at some point(LJM will be accepting only 'serviceUrl' option
|
connectionConfig.serviceUrl = serviceUrl;
|
||||||
// in future). It's included for the time being for Jitsi Meet and lib-jitsi-meet versions interoperability.
|
|
||||||
connectionConfig.serviceUrl = connectionConfig.bosh = serviceUrl;
|
|
||||||
|
|
||||||
if (connectionConfig.websocketKeepAliveUrl) {
|
if (connectionConfig.websocketKeepAliveUrl) {
|
||||||
connectionConfig.websocketKeepAliveUrl += `?room=${roomName}`;
|
connectionConfig.websocketKeepAliveUrl += `?room=${roomName}`;
|
||||||
|
|
|
@ -181,7 +181,7 @@ export function initAnalytics({ getState }: { getState: Function }, handlers: Ar
|
||||||
permanentProperties.appName = getAppName();
|
permanentProperties.appName = getAppName();
|
||||||
|
|
||||||
// Report if user is using websocket
|
// 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
|
// Report if user is using the external API
|
||||||
permanentProperties.externalApi = typeof API_ID === 'number';
|
permanentProperties.externalApi = typeof API_ID === 'number';
|
||||||
|
|
|
@ -275,10 +275,11 @@ function _constructOptions(state) {
|
||||||
// redux store.
|
// redux store.
|
||||||
const options = _.cloneDeep(state['features/base/config']);
|
const options = _.cloneDeep(state['features/base/config']);
|
||||||
|
|
||||||
// Normalize the BOSH URL.
|
|
||||||
let { bosh } = options;
|
let { bosh } = options;
|
||||||
|
const { websocket } = options;
|
||||||
|
|
||||||
if (bosh) {
|
// Normalize the BOSH URL.
|
||||||
|
if (bosh && !websocket) {
|
||||||
const { locationURL } = state['features/base/connection'];
|
const { locationURL } = state['features/base/connection'];
|
||||||
|
|
||||||
if (bosh.startsWith('//')) {
|
if (bosh.startsWith('//')) {
|
||||||
|
@ -295,14 +296,22 @@ function _constructOptions(state) {
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
bosh = `${protocol}//${host}${contextRoot || '/'}${bosh.substr(1)}`;
|
bosh = `${protocol}//${host}${contextRoot || '/'}${bosh.substr(1)}`;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Append room to the URL's search.
|
// WebSocket is preferred over BOSH.
|
||||||
const { room } = state['features/base/conference'];
|
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.
|
if (serviceUrl && room) {
|
||||||
options.serviceUrl = options.bosh = bosh;
|
const roomName = getBackendSafeRoomName(room);
|
||||||
|
|
||||||
|
options.serviceUrl = `${serviceUrl}?room=${roomName}`;
|
||||||
|
|
||||||
|
if (options.websocketKeepAliveUrl) {
|
||||||
|
options.websocketKeepAliveUrl += `?room=${roomName}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
|
|
Loading…
Reference in New Issue