Skip to content

Latest commit

 

History

History
203 lines (181 loc) · 7.21 KB

Configuring.md

File metadata and controls

203 lines (181 loc) · 7.21 KB

StanzaJS Configuration

Configuring a StanzaJS client is done when calling createClient():

import * as XMPP from 'stanza';

const client = XMPP.createClient({
    // Configuration Settings
});

It is possible to inspect the configuration later by using client.config.

Available Settings

Accepted Languages

NameTypeDefault Value
acceptLanguages string[] undefined

A list of language codes acceptable to the user.

Allow Stream Management Resumption

NameTypeDefault Value
allowResumption false | true true

When true (along with useStreamManagement), the session will be resumable after a disconnect.

However, this means that the session will still appear as alive for a few minutes after a connection loss.

Entity Caps Disco Node

NameTypeDefault Value
capsNode string "https://stanzajs.org"

The disco info node prefix to use for entity capability advertisements.

Send Chat Markers

NameTypeDefault Value
chatMarkers false | true true

When enabled, message display markers will automatically be sent when requested.

Account Credentials

NameTypeDefault Value
credentials Credentials undefined

The credentials object is used to pass multiple credential values (not just a password). These are primarily values that have been previously cached.

If you only need to set a password, then the password config field can be used instead.

User JID

NameTypeDefault Value
jid string undefined

jingle

NameTypeDefault Value
jingle JinglePluginConfig undefined

User Language

NameTypeDefault Value
lang string undefined

The associated language code for content created by the user.

Account Password

NameTypeDefault Value
password string undefined

Equivalent to using credentials: { password: '*****' }.

Connection Resource

NameTypeDefault Value
resource string undefined

Optionally request for the server to bind a specific resource for the connection.

Note that the server is allowed ignore the request.

Roster Version

NameTypeDefault Value
rosterVer string undefined

The latest known version of the user's roster.

If the version matches the version on the server, roster data does not need to be sent to the client.

Send Message Delivery Receipts

NameTypeDefault Value
sendReceipts false | true true

When enabled, message receipts will automatically be sent when requested.

Server Domain Name

NameTypeDefault Value
server string undefined

Set the expected name of the server instead of using domain in the provided JID.

Software Version Info

NameTypeDefault Value
softwareVersion SoftwareVersion { name: "stanzajs.org" }

IQ Timeout

NameTypeDefault Value
timeout number 15

The number of seconds to wait before timing out IQ requests.

Transport Configurations

NameTypeDefault Value
transports { websocket: true, bosh: true }

Limit the transport types that will be used, or specify connection URLs to use without needing to use auto-discovery.

If a transport is set to false, it will be disabled.

If a transport is set to a string, that will be used as the connection URL.

If a transport is set to an object, it MUST include a url value for the connection URL.

Use Stream Management

NameTypeDefault Value
useStreamManagement false | true true

Controls if XEP-0198: Stream Management is enabled for the session.

Disabling stream management is not recommended.