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.
- acceptLanguages
- allowResumption
- capsNode
- chatMarkers
- credentials
- jid
- jingle
- lang
- password
- resource
- rosterVer
- sendReceipts
- server
- softwareVersion
- timeout
- transports
- useStreamManagement
| Name | Type | Default Value |
|---|---|---|
acceptLanguages |
string[] |
undefined |
A list of language codes acceptable to the user.
| Name | Type | Default 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.
| Name | Type | Default Value |
|---|---|---|
capsNode |
string |
"https://stanzajs.org" |
The disco info node prefix to use for entity capability advertisements.
| Name | Type | Default Value |
|---|---|---|
chatMarkers |
false | true |
true |
When enabled, message display markers will automatically be sent when requested.
| Name | Type | Default 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.
| Name | Type | Default Value |
|---|---|---|
jid |
string |
undefined |
| Name | Type | Default Value |
|---|---|---|
jingle |
JinglePluginConfig |
undefined |
| Name | Type | Default Value |
|---|---|---|
lang |
string |
undefined |
The associated language code for content created by the user.
| Name | Type | Default Value |
|---|---|---|
password |
string |
undefined |
Equivalent to using credentials: { password: '*****' }.
| Name | Type | Default 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.
| Name | Type | Default 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.
| Name | Type | Default Value |
|---|---|---|
sendReceipts |
false | true |
true |
When enabled, message receipts will automatically be sent when requested.
| Name | Type | Default Value |
|---|---|---|
server |
string |
undefined |
Set the expected name of the server instead of using domain in the provided JID.
| Name | Type | Default Value |
|---|---|---|
softwareVersion |
SoftwareVersion |
{ name: "stanzajs.org" } |
| Name | Type | Default Value |
|---|---|---|
timeout |
number |
15 |
The number of seconds to wait before timing out IQ requests.
| Name | Type | Default 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.
| Name | Type | Default Value |
|---|---|---|
useStreamManagement |
false | true |
true |
Controls if XEP-0198: Stream Management is enabled for the session.
Disabling stream management is not recommended.