diff --git a/conference.js b/conference.js index d12828c84f..aa31c6def3 100644 --- a/conference.js +++ b/conference.js @@ -34,10 +34,12 @@ const Commands = { /** * Open Connection. When authentication failed it shows auth dialog. + * @param roomName the room name to use * @returns Promise */ -function connect() { - return openConnection({retry: true}).catch(function (err) { +function connect(roomName) { + return openConnection({retry: true, roomName: roomName}) + .catch(function (err) { if (err === ConnectionErrors.PASSWORD_REQUIRED) { APP.UI.notifyTokenAuthFailed(); } else { @@ -287,7 +289,7 @@ export default { .catch(() => createLocalTracks('audio')) // if audio also failed then just return empty array .catch(() => []), - connect() + connect(options.roomName) ]); }).then(([tracks, con]) => { console.log('initialized with %s local tracks', tracks.length); diff --git a/connection.js b/connection.js index 0fd775bc1a..b6348a7741 100644 --- a/connection.js +++ b/connection.js @@ -9,10 +9,15 @@ const ConnectionErrors = JitsiMeetJS.errors.connection; * Try to open connection using provided credentials. * @param {string} [id] * @param {string} [password] + * @param {string} [roomName] * @returns {Promise} connection if * everything is ok, else error. */ -function connect(id, password) { +function connect(id, password, roomName) { + + let connectionConfig = config; + + connectionConfig.bosh += '?room=' + roomName; let connection = new JitsiMeetJS.JitsiConnection(null, null, config); return new Promise(function (resolve, reject) { @@ -82,13 +87,14 @@ function requestAuth() { * @param {object} options * @param {string} [options.id] * @param {string} [options.password] + * @param {string} [options.roomName] * @param {boolean} [retry] if we should show auth dialog * on PASSWORD_REQUIRED error. * * @returns {Promise} */ -export function openConnection({id, password, retry}) { - return connect(id, password).catch(function (err) { +export function openConnection({id, password, retry, roomName}) { + return connect(id, password, roomName).catch(function (err) { if (!retry) { throw err; }