Adds room name to the bosh connection.
This commit is contained in:
parent
bd16b9e346
commit
b4b9160fcb
|
@ -34,10 +34,12 @@ const Commands = {
|
|||
|
||||
/**
|
||||
* Open Connection. When authentication failed it shows auth dialog.
|
||||
* @param roomName the room name to use
|
||||
* @returns Promise<JitsiConnection>
|
||||
*/
|
||||
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);
|
||||
|
|
|
@ -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<JitsiConnection>} 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<JitsiConnection>}
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue