Pārlūkot izejas kodu

Adds room name to the bosh connection.

j8
damencho 9 gadus atpakaļ
vecāks
revīzija
b4b9160fcb
2 mainītis faili ar 14 papildinājumiem un 6 dzēšanām
  1. 5
    3
      conference.js
  2. 9
    3
      connection.js

+ 5
- 3
conference.js Parādīt failu

34
 
34
 
35
 /**
35
 /**
36
  * Open Connection. When authentication failed it shows auth dialog.
36
  * Open Connection. When authentication failed it shows auth dialog.
37
+ * @param roomName the room name to use
37
  * @returns Promise<JitsiConnection>
38
  * @returns Promise<JitsiConnection>
38
  */
39
  */
39
-function connect() {
40
-    return openConnection({retry: true}).catch(function (err) {
40
+function connect(roomName) {
41
+    return openConnection({retry: true, roomName: roomName})
42
+            .catch(function (err) {
41
         if (err === ConnectionErrors.PASSWORD_REQUIRED) {
43
         if (err === ConnectionErrors.PASSWORD_REQUIRED) {
42
             APP.UI.notifyTokenAuthFailed();
44
             APP.UI.notifyTokenAuthFailed();
43
         } else {
45
         } else {
287
                     .catch(() => createLocalTracks('audio'))
289
                     .catch(() => createLocalTracks('audio'))
288
                 // if audio also failed then just return empty array
290
                 // if audio also failed then just return empty array
289
                     .catch(() => []),
291
                     .catch(() => []),
290
-                connect()
292
+                connect(options.roomName)
291
             ]);
293
             ]);
292
         }).then(([tracks, con]) => {
294
         }).then(([tracks, con]) => {
293
             console.log('initialized with %s local tracks', tracks.length);
295
             console.log('initialized with %s local tracks', tracks.length);

+ 9
- 3
connection.js Parādīt failu

9
  * Try to open connection using provided credentials.
9
  * Try to open connection using provided credentials.
10
  * @param {string} [id]
10
  * @param {string} [id]
11
  * @param {string} [password]
11
  * @param {string} [password]
12
+ * @param {string} [roomName]
12
  * @returns {Promise<JitsiConnection>} connection if
13
  * @returns {Promise<JitsiConnection>} connection if
13
  * everything is ok, else error.
14
  * everything is ok, else error.
14
  */
15
  */
15
-function connect(id, password) {
16
+function connect(id, password, roomName) {
17
+
18
+    let connectionConfig = config;
19
+
20
+    connectionConfig.bosh += '?room=' + roomName;
16
     let connection = new JitsiMeetJS.JitsiConnection(null, null, config);
21
     let connection = new JitsiMeetJS.JitsiConnection(null, null, config);
17
 
22
 
18
     return new Promise(function (resolve, reject) {
23
     return new Promise(function (resolve, reject) {
82
  * @param {object} options
87
  * @param {object} options
83
  * @param {string} [options.id]
88
  * @param {string} [options.id]
84
  * @param {string} [options.password]
89
  * @param {string} [options.password]
90
+ * @param {string} [options.roomName]
85
  * @param {boolean} [retry] if we should show auth dialog
91
  * @param {boolean} [retry] if we should show auth dialog
86
  * on PASSWORD_REQUIRED error.
92
  * on PASSWORD_REQUIRED error.
87
  *
93
  *
88
  * @returns {Promise<JitsiConnection>}
94
  * @returns {Promise<JitsiConnection>}
89
  */
95
  */
90
-export function openConnection({id, password, retry}) {
91
-    return connect(id, password).catch(function (err) {
96
+export function openConnection({id, password, retry, roomName}) {
97
+    return connect(id, password, roomName).catch(function (err) {
92
         if (!retry) {
98
         if (!retry) {
93
             throw err;
99
             throw err;
94
         }
100
         }

Notiek ielāde…
Atcelt
Saglabāt