Przeglądaj źródła

ref: deprecate and rename 'bosh' option to 'serviceUrl' (#1022)

It can either be a websocket or bosh URL, so the current naming is
confusing.
master
Paweł Domas 5 lat temu
rodzic
commit
3dcd26e6c2
No account linked to committer's email address
2 zmienionych plików z 16 dodań i 11 usunięć
  1. 5
    4
      doc/API.md
  2. 11
    7
      modules/xmpp/xmpp.js

+ 5
- 4
doc/API.md Wyświetl plik

@@ -219,13 +219,14 @@ This objects represents the server connection. You can create new ```JitsiConnec
219 219
     - appID - identification for the provider of Jitsi Meet video conferencing services. **NOTE: not implemented yet. You can safely pass ```null```**
220 220
     - token - secret generated by the provider of Jitsi Meet video conferencing services. The token will be send to the provider from the Jitsi Meet server deployment for authorization of the current client.
221 221
     - options - JS object with configuration options for the server connection. You can change the following properties there:
222
-        1. bosh -
223
-        2. hosts - JS Object
222
+        1. serviceUrl - XMPP service URL. For  example 'wss://server.com/xmpp-websocket' for Websocket or '//server.com/http-bind' for BOSH.
223
+        2. bosh - DEPRECATED, use serviceUrl to specify either BOSH or Websocket URL.
224
+        3. hosts - JS Object
224 225
             - domain
225 226
             - muc
226 227
             - anonymousdomain
227
-        3. useStunTurn -
228
-        4. enableLipSync - (optional) boolean property which enables the lipsync feature. Currently works only in Chrome and is enabled by default.
228
+        4. useStunTurn -
229
+        5. enableLipSync - (optional) boolean property which enables the lipsync feature. Currently works only in Chrome and is enabled by default.
229 230
 
230 231
 2. connect(options) - establish server connection
231 232
     - options - JS Object with ```id``` and ```password``` properties.

+ 11
- 7
modules/xmpp/xmpp.js Wyświetl plik

@@ -23,18 +23,18 @@ import XMPPEvents from '../../service/xmpp/XMPPEvents';
23 23
 const logger = getLogger(__filename);
24 24
 
25 25
 /**
26
- *
27
- * @param token
28
- * @param bosh
26
+ * Creates XMPP connection.
27
+ * @param {string} [token] - JWT token used for authentication(JWT authentication module must be enabled in Prosody).
28
+ * @param {string} serviceUrl - The service URL for XMPP connection.
29 29
  */
30
-function createConnection(token, bosh = '/http-bind') {
30
+function createConnection(token, serviceUrl = '/http-bind') {
31 31
     // Append token as URL param
32 32
     if (token) {
33 33
         // eslint-disable-next-line no-param-reassign
34
-        bosh += `${bosh.indexOf('?') === -1 ? '?' : '&'}token=${token}`;
34
+        serviceUrl += `${serviceUrl.indexOf('?') === -1 ? '?' : '&'}token=${token}`;
35 35
     }
36 36
 
37
-    const conn = new Strophe.Connection(bosh);
37
+    const conn = new Strophe.Connection(serviceUrl);
38 38
 
39 39
     // The default maxRetries is 5, which is too long.
40 40
     conn.maxRetries = 3;
@@ -67,6 +67,9 @@ export default class XMPP extends Listenable {
67 67
     /**
68 68
      * FIXME describe all options
69 69
      * @param {Object} options
70
+     * @param {String} options.serviceUrl - URL passed to the XMPP client which will be used to establish XMPP
71
+     * connection with the server.
72
+     * @param {String} options.bosh - Deprecated, use {@code serviceUrl}.
70 73
      * @param {Array<Object>} options.p2pStunServers see
71 74
      * {@link JingleConnectionPlugin} for more details.
72 75
      * @param token
@@ -81,7 +84,8 @@ export default class XMPP extends Listenable {
81 84
         this.authenticatedUser = false;
82 85
         this._initStrophePlugins(this);
83 86
 
84
-        this.connection = createConnection(token, options.bosh);
87
+        // FIXME remove deprecated bosh option at some point
88
+        this.connection = createConnection(token, options.serviceUrl || options.bosh);
85 89
 
86 90
         this._lastSuccessTracker = new LastSuccessTracker();
87 91
         this._lastSuccessTracker.startTracking(this.connection);

Ładowanie…
Anuluj
Zapisz