Browse Source

Adds room name to the bosh connection.

master
damencho 9 years ago
parent
commit
b4b9160fcb
2 changed files with 14 additions and 6 deletions
  1. 5
    3
      conference.js
  2. 9
    3
      connection.js

+ 5
- 3
conference.js View File

@@ -34,10 +34,12 @@ const Commands = {
34 34
 
35 35
 /**
36 36
  * Open Connection. When authentication failed it shows auth dialog.
37
+ * @param roomName the room name to use
37 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 43
         if (err === ConnectionErrors.PASSWORD_REQUIRED) {
42 44
             APP.UI.notifyTokenAuthFailed();
43 45
         } else {
@@ -287,7 +289,7 @@ export default {
287 289
                     .catch(() => createLocalTracks('audio'))
288 290
                 // if audio also failed then just return empty array
289 291
                     .catch(() => []),
290
-                connect()
292
+                connect(options.roomName)
291 293
             ]);
292 294
         }).then(([tracks, con]) => {
293 295
             console.log('initialized with %s local tracks', tracks.length);

+ 9
- 3
connection.js View File

@@ -9,10 +9,15 @@ const ConnectionErrors = JitsiMeetJS.errors.connection;
9 9
  * Try to open connection using provided credentials.
10 10
  * @param {string} [id]
11 11
  * @param {string} [password]
12
+ * @param {string} [roomName]
12 13
  * @returns {Promise<JitsiConnection>} connection if
13 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 21
     let connection = new JitsiMeetJS.JitsiConnection(null, null, config);
17 22
 
18 23
     return new Promise(function (resolve, reject) {
@@ -82,13 +87,14 @@ function requestAuth() {
82 87
  * @param {object} options
83 88
  * @param {string} [options.id]
84 89
  * @param {string} [options.password]
90
+ * @param {string} [options.roomName]
85 91
  * @param {boolean} [retry] if we should show auth dialog
86 92
  * on PASSWORD_REQUIRED error.
87 93
  *
88 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 98
         if (!retry) {
93 99
             throw err;
94 100
         }

Loading…
Cancel
Save