Permalink
Browse files

enable passing an additional argument to the WebSocket constructor (e…

….g., for faye-websocket-node to accept TLS options)

Example usage:

    let XMPP   = require('stanza.io');
    let client = XMPP.createClient({
        jid         : "user@example.com",
        password    : "password",
        transports  : [ "websocket" ],
        wsURL       : "https://xmpp.example.com",
        wsOptions   : { tls : { servername : "test.xmpp.example.com" } }
    });
  • Loading branch information...
Mike Eldridge
Mike Eldridge committed Dec 16, 2017
1 parent 23149b2 commit 203386725529b77911a67e61419ce95129c7e200
Showing with 2 additions and 1 deletion.
  1. +1 −0 docs/Reference.md
  2. +1 −1 lib/transports/websocket.js
View
@@ -246,6 +246,7 @@ When creating a client instance, the following settings will configure its behav
- `sendReceipts` - boolean value to determine whether or not client automatically sends acknowledgements if they are requested (XEP-0184). Default value is true, set to false if you want to send acknowledgements yourself.
- `transports` - a strings array of transport methods that may be used.
- `wsURL` - URL for the XMPP over WebSocket connection endpoint.
- `wsOptions` - additional options passed to WebSocket constructor (optional and not supported by all WebSocket clients)
- `boshURL` - URL for the BOSH connection endpoint.
- `sasl` - a list of the SASL mechanisms that are acceptable for use by the client.
- `useStreamManagement` - set to `true` to enable resuming the session after a disconnect.
@@ -93,7 +93,7 @@ WSConnection.prototype.connect = function (opts) {
self.hasStream = false;
self.closing = false;
self.conn = new WS(opts.wsURL, 'xmpp');
self.conn = new WS(opts.wsURL, 'xmpp', opts.wsOptions);
self.conn.onerror = function (e) {
e.preventDefault();
self.emit('disconnected', self);

0 comments on commit 2033867

Please sign in to comment.