Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jaas) add zero-config mode for JaaS customers #2502

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 33 additions & 5 deletions JitsiConnection.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import clonedeep from 'lodash.clonedeep';

import JitsiConference from './JitsiConference';
import * as JitsiConnectionEvents from './JitsiConnectionEvents';
import FeatureFlags from './modules/flags/FeatureFlags';
Expand All @@ -8,6 +10,11 @@ import {
createConnectionFailedEvent
} from './service/statistics/AnalyticsEvents';

/**
* Prefix used by JaaS apps.
*/
const JAAS_APPID_PREFIX = 'vpaas-magic-cookie';

/**
* Creates a new connection object for the Jitsi Meet server side video
* conferencing service. Provides access to the JitsiConference interface.
Expand All @@ -18,15 +25,36 @@ import {
* the server.
* @constructor
*/
export default function JitsiConnection(appID, token, options) {
this.appID = appID;
export default function JitsiConnection(appID, token, options = {}) {
this.appID = (appID || '').toLowerCase();
this.token = token;
this.options = options;

const _options = clonedeep(options);

// If a JaaS app ID was provided but no options, provide some ourselves.
if (this.appID.startsWith(JAAS_APPID_PREFIX)) {
if (!_options.hosts) {
_options.hosts = {
domain: '8x8.vc',
muc: `conference.${this.appID}.8x8.vc`
};
}

if (!_options.serviceUrl && !_options.bosh && !_options.websocket) {
_options.serviceUrl = `wss://8x8.vc/${this.appID}/xmpp-websocket`;
}

if (!_options.websocketKeepAliveUrl) {
_options.websocketKeepAliveUrl = `https://8x8.vc/${this.appID}/_unlock`;
}
}

this.options = _options;

// Initialize the feature flags so that they are advertised through the disco-info.
FeatureFlags.init(options.flags || {});
FeatureFlags.init(_options.flags || {});

this.xmpp = new XMPP(options, token);
this.xmpp = new XMPP(this.options, token);

/* eslint-disable max-params */
this.addEventListener(JitsiConnectionEvents.CONNECTION_FAILED,
Expand Down
Loading