Converse converse.js

Global

Members

(constant) helpers

Pure functions to help functionally parse messages.

License:
  • Mozilla Public License (MPLv2)
Source:
To Do:
  • Other parsing helpers can be made more abstract and placed here.

punycode :Object

The punycode object.

Type:
  • Object
Source:

(constant) renderImage

lit directive which attempts to render an element from a URL. It will fall back to rendering an element if it can't.

Source:

Methods

_markScrolled()

Called when the chat content is scrolled up or down. We want to record when the user has scrolled away from the bottom, so that we don't automatically scroll away from what the user is reading when new messages are received.

Don't call this method directly, instead, call markScrolled, which debounces this method.

Source:

(private) addResource(presence:)

Adds a new resource and it's associated attributes as taken from the passed in presence stanza. Also updates the presence if the resource has higher priority (and is newer).

Parameters:
Name Type Description
presence: XMLElement

The presence stanza

Source:

applyDragResistance(value, default_value) → {Integer}

Applies some resistance to value around the default_value. If value is close enough to default_value, then it is returned, otherwise value is returned.

Parameters:
Name Type Description
value Integer
default_value Integer
Source:
Returns:
Type
Integer

autoJoinRooms()

Automatically join groupchats, based on the "auto_join_rooms" configuration setting, which is an array of strings (groupchat JIDs) or objects (with groupchat JID and other settings).

Source:

bitsToNum()

Started as a fork of Shachaf Ben-Kiki's jsgif library https://github.com/shachaf/jsgif

License:
  • MIT License
Source:

checkFileTypes(types, url) → {Boolean}

Given the an array of file extensions, check whether a URL points to a file ending in one of them.

Parameters:
Name Type Description
types Array.<String>

An array of file extensions

url String
Source:
Returns:
Type
Boolean
Example
checkFileTypes(['.gif'], 'https://conversejs.org/cat.gif?foo=bar');

computeAffiliationsDelta(exclude_existing, remove_absentees, new_list, old_list) → {array}

Given two lists of objects with 'jid', 'affiliation' and 'reason' properties, return a new list containing those objects that are new, changed or removed (depending on the 'remove_absentees' boolean).

The affiliations for new and changed members stay the same, for removed members, the affiliation is set to 'none'.

The 'reason' property is not taken into account when comparing whether affiliations have been changed.

Parameters:
Name Type Description
exclude_existing boolean

Indicates whether JIDs from the new list which are also in the old list (regardless of affiliation) should be excluded from the delta. One reason to do this would be when you want to add a JID only if it doesn't have any existing affiliation at all.

remove_absentees boolean

Indicates whether JIDs from the old list which are not in the new list should be considered removed and therefore be included in the delta with affiliation set to 'none'.

new_list array

Array containing the new affiliations

old_list array

Array containing the old affiliations

Source:
Returns:
Type
array

(async) createPlaceholder(model, options, result)

Create a placeholder message which is used to indicate gaps in the history.

Parameters:
Name Type Description
model _converse.ChatBox | _converse.ChatRoom
options MAMOptions
result object

The RSM result object

Source:

fetchArchivedMessages(model, optionsopt, should_pageopt)

Fetch XEP-0313 archived messages based on the passed in criteria.

Parameters:
Name Type Attributes Default Description
model _converse.ChatBox | _converse.ChatRoom
options MAMOptions <optional>
should_page 'forwards' | 'backwards' | null <optional>
null

Determines whether this function should recursively page through the entire result set if a limited number of results were returned.

Source:

(private) fetchFromServer() → {promise}

Fetch the roster from the XMPP server

Source:
Fires:
Returns:
Type
promise

fetchGIF(url) → {Promise.<String>}

Makes an HTTP request to fetch a GIF

Parameters:
Name Type Description
url String
Source:
Returns:

Returns a promise which resolves with the response data.

Type
Promise.<String>

fetchNewestMessages(model)

Fetches messages that might have been archived after the last archived message in our local cache.

Parameters:
Name Type Description
model _converse.ChatBox | _converse.ChatRoom
Source:

(private) fetchRosterContacts() → {promise}

Fetches the roster contacts, first by trying the browser cache, and if that's empty, then by querying the XMPP server.

Source:
Returns:

Promise which resolves once the contacts have been fetched.

Type
promise

generateBundle()

Generate the data used by the X3DH key agreement protocol that can be used to build a session with a device.

Source:

getAffiliationList(affiliation, muc_jid) → {Promise.<Array.<MemberListItem>>}

Sends an IQ stanza to the server, asking it for the relevant affiliation list . Returns an array of MemberListItem objects, representing occupants that have the given affiliation. See: https://xmpp.org/extensions/xep-0045.html#modifymember

Parameters:
Name Type Description
affiliation "admin" | "owner" | "member"
muc_jid String

The JID of the MUC for which the affiliation list should be fetched

Source:
Returns:
Type
Promise.<Array.<MemberListItem>>

getAssignableAffiliations(occupant) → {Array.<('owner'|'admin'|'member'|'outcast'|'none')>}

Given an occupant model, see which affiliations may be assigned to that user.

Parameters:
Name Type Description
occupant Model
Source:
Returns:
  • An array of assignable affiliations
Type
Array.<('owner'|'admin'|'member'|'outcast'|'none')>

getAssignableRoles(occupant) → {Array.<('moderator'|'participant'|'visitor')>}

Given an occupant model, see which roles may be assigned to that user.

Parameters:
Name Type Description
occupant Model
Source:
Returns:
  • An array of assignable roles
Type
Array.<('moderator'|'participant'|'visitor')>

getAttributes(stanza) → {Object}

Returns an object containing all attribute names and values for a particular element.

Parameters:
Name Type Description
stanza XMLElement
Source:
Returns:
Type
Object

getAttributes(stanza) → {Object}

Returns an object containing all attribute names and values for a particular element.

Parameters:
Name Type Description
stanza XMLElement
Source:
Returns:
Type
Object

(private) getChatMarker(stanza) → {Boolean}

Determines whether the passed in stanza is a XEP-0333 Chat Marker

Parameters:
Name Type Description
stanza XMLElement

The message stanza

Source:
Returns:
Type
Boolean

(private) getChatMarker(stanza) → {Boolean}

Determines whether the passed in stanza is a XEP-0333 Chat Marker

Parameters:
Name Type Description
stanza XMLElement

The message stanza

Source:
Returns:
Type
Boolean

(private) getChatState(stanza)

Returns the XEP-0085 chat state contained in a message stanza

Parameters:
Name Type Description
stanza XMLElement

The message stanza

Source:

getDayIndicator(message)

Given a message object, returns a TemplateResult indicating a new day if the passed in message is more than a day later than its predecessor.

Parameters:
Name Type Description
message _converse.Message
Source:

getDirective(text, i, opening)

Given a specific index "i" of "text", return the directive it matches or null otherwise.

Parameters:
Name Type Default Description
text String

The text in which the directive appears

i Number

The directive index

opening Boolean true

Whether we're looking for an opening or closing directive

Source:

getDirectiveLength(d, i, text)

Given a directive "d", which occurs in "text" at index "i", check that it has a valid closing directive and return the length from start to end of the directive.

Parameters:
Name Type Description
d String

The directive

i Number

The directive index

text String

The text in which the directive appears

Source:

(private) getErrorAttributes(stanza)

Returns the human readable error message contained in a groupchat message stanza of type error.

Parameters:
Name Type Description
stanza XMLElement

The message stanza

Source:

getFilterCriteria() → {String}

Return a string of tab-separated values that are to be used when matching against filter text.

The goal is to be able to filter against the VCard fullname, roster nickname and JID.

Source:
Returns:

Lower-cased, tab-separated values

Type
String

(async) getHeadingButtons()

Returns a list of objects which represent buttons for the chat's header.

Source:
Fires:

getHeadingButtons()

Returns a list of objects which represent buttons for the groupchat header.

Source:
Fires:

(private) getHighestPriorityResource()

Return the resource with the highest priority. If multiple resources have the same priority, take the latest one.

Source:

(private) getJIDFromMUCUserData(stanza) → {Object}

Given a MUC stanza, check whether it has extended message information that includes the sender's real JID, as described here: https://xmpp.org/extensions/xep-0313.html#business-storeret-muc-archives

If so, parse and return that data and return the user's JID

Note, this function doesn't check whether this is actually a MAM archived stanza.

Parameters:
Name Type Description
stanza XMLElement

The message stanza

Source:
Returns:
Type
Object

getMediaURLs(arr, text)

Given an array of MediaURLMetadata objects and text, return an array of MediaURL objects.

Parameters:
Name Type Description
arr Array.<MediaURLMetadata>
text String
Source:

getMEPActivities(stanza) → {Array}

Parses a message stanza for XEP-0317 MEP notification data

Parameters:
Name Type Description
stanza XMLElement

The message stanza

Source:
Returns:

Returns an array of objects representing elements.

Type
Array

getMessageReferencedByError(attrs)

Given an error <message> stanza's attributes, find the saved message model which is referenced by that error.

Parameters:
Name Type Description
attrs Object
Source:

getMessageReferencedByError(attrs)

Given an error <message> stanza's attributes, find the saved message model which is referenced by that error.

Parameters:
Name Type Description
attrs Object
Source:

(private) getModerationAttributes(stanza, original_stanza) → {Object}

Parameters:
Name Type Description
stanza XMLElement

The message stanza

original_stanza XMLElement

The original stanza, that contains the message stanza, if it was contained, otherwise it's the message stanza itself.

Source:
Returns:
Type
Object

getNextFrameNo() → {number}

Gets the index of the frame "up next"

Source:
Returns:
Type
number

(private) getRetractionAttributes(stanza, original_stanza) → {Object}

Parameters:
Name Type Description
stanza XMLElement

The message stanza

original_stanza XMLElement

The original stanza, that contains the message stanza, if it was contained, otherwise it's the message stanza itself.

Source:
Returns:
Type
Object

(private) getStanzaIDs(stanza) → {Object}

Extract the XEP-0359 stanza IDs from the passed in stanza and return a map containing them.

Parameters:
Name Type Description
stanza XMLElement

The message stanza

Source:
Returns:
Type
Object

handleChatStateNotification()

Event handler for on('contactPresenceChanged'). Will show an HTML5 notification to indicate that the chat status has changed.

Source:

handleEOF()

Handler for when the end of the GIF's file has been reached

Source:

handleGCE()

Handler for GIF Graphic Control Extension (GCE) data

Source:

handleMessageNotification()

Event handler for the on('message') event. Will call methods to play sounds and show HTML5 notifications.

Source:

(private) handleMessageStanza(attrs)

Handler method for all incoming single-user chat "message" stanzas.

Parameters:
Name Type Description
attrs MessageAttributes

The message attributes

Source:

(async) initUserSettings()

Source:

insertIntoTextArea(value, replaceopt, positionopt)

Insert a particular string value into the textarea of this chat box.

Parameters:
Name Type Attributes Default Description
value string

The value to be inserted.

replace boolean | string <optional>
false

Whether an existing value should be replaced. If set to true, the entire textarea will be replaced with the new value. If set to a string, then only that string will be replaced if a position is also specified.

position integer <optional>

The end index of the string to be replaced with the new value.

Source:

isAllowedProtocolForMedia(url) → {Boolean}

Given a url, check whether the protocol being used is allowed for rendering the media in the chat (as opposed to just rendering a URL hyperlink).

Parameters:
Name Type Description
url String
Source:
Returns:
Type
Boolean

(private) isArchived(stanza) → {Boolean}

Determines whether the passed in stanza is a XEP-0313 MAM stanza

Parameters:
Name Type Description
stanza XMLElement

The message stanza

Source:
Returns:
Type
Boolean

(private) isArchived(stanza) → {Boolean}

Determines whether the passed in stanza is a XEP-0313 MAM stanza

Parameters:
Name Type Description
stanza XMLElement

The message stanza

Source:
Returns:
Type
Boolean

(private) isCarbon(stanza) → {Boolean}

Determines whether the passed in stanza is a XEP-0280 Carbon

Parameters:
Name Type Description
stanza XMLElement

The message stanza

Source:
Returns:
Type
Boolean

isHidden() → {boolean}

Indicates whether the chat is hidden and therefore whether a newly received message will be visible to the user or not.

Source:
Returns:
Type
boolean

isHidden() → {boolean}

Indicates whether the chat is hidden and therefore whether a newly received message will be visible to the user or not.

Source:
Returns:
Type
boolean

isMediaURLDomainAllowed(o) → {Bool}

Accepts a MediaURL object and then checks whether its domain is allowed for rendering in the chat.

Parameters:
Name Type Description
o MediaURL
Source:
Returns:
Type
Bool

isValidDirective(d, text, i, opening)

Checks whether a given character "d" at index "i" of "text" is a valid opening or closing directive.

Parameters:
Name Type Description
d String

The potential directive

text String

The text in which the directive appears

i Number

The directive index

opening Boolean

Check for a valid opening or closing directive

Source:

onAnimationFrame(timestamp, previous_timestamp, frame_delay)

Inner callback for the requestAnimationFrame function.

This method gets wrapped by an arrow function so that the previous_timestamp and frame_delay parameters can also be passed in. The timestamp parameter comes from requestAnimationFrame.

The purpose of this method is to call putFrame with the right delay in order to render the GIF animation.

Note, this method will cause the next upcoming frame to be rendered, not the current one.

This means this.frame_idx will be incremented before calling this.putFrame, so putFrame(0) needs to be called before this method, otherwise the animation will incorrectly start from frame #1 (this is done in initPlayer).

Parameters:
Name Type Description
timestamp DOMHighRestTimestamp

The timestamp as returned by requestAnimationFrame

previous_timestamp DOMHighRestTimestamp

The timestamp from the previous iteration of this method. We need this in order to calculate whether we have waited long enough to show the next frame.

frame_delay Number

The delay (in 1/100th of a second) before the currently being shown frame should be replaced by a new one.

Source:

onChatBoxesInitialized()

Roster specific event handler for the chatBoxesInitialized event

Source:

onClearSession()

Roster specific event handler for the clearSession event

Source:

onDisconnected()

Gets called once strophe's status reaches Strophe.Status.DISCONNECTED. Will either start a teardown process for converse.js or attempt to reconnect.

Source:

onDisconnected()

Gets called once strophe's status reaches Strophe.Status.DISCONNECTED. Will either start a teardown process for converse.js or attempt to reconnect.

Source:

onIterationEnd() → {Boolean}

Called once we've looped through all frames in the GIF

Source:
Returns:
  • Returns true if the GIF is now paused (i.e. further iterations are not desired)
Type
Boolean

onMAMPreferences()

Handle returned IQ stanza containing Message Archive Management (XEP-0313) preferences.

XXX: For now we only handle the global default preference. The XEP also provides for per-JID preferences, which is currently not supported in converse.js.

Per JID preferences will be set in chat boxes, so it'll probbaly be handled elsewhere in any case.

Source:

onMaximized() → {_converse.ChatBoxView|_converse.ChatRoomView}

Handler which gets called when a _converse#ChatBox has it's minimized property set to false.

Will trigger _converse#chatBoxMaximized

Source:
Returns:
Type
_converse.ChatBoxView | _converse.ChatRoomView

onMinimized() → {_converse.ChatBoxView|_converse.ChatRoomView}

Handler which gets called when a _converse#ChatBox has it's minimized property set to true.

Will trigger _converse#chatBoxMinimized

Source:
Returns:
Type
_converse.ChatBoxView | _converse.ChatRoomView

onPresencesInitialized(reconnecting)

Roster specific event handler for the presencesInitialized event

Parameters:
Name Type Description
reconnecting Boolean
Source:

onRosterContactsFetched()

Roster specific handler for the rosterContactsFetched promise

Source:

onStatusInitialized(reconnecting)

Roster specific event handler for the statusInitialized event

Parameters:
Name Type Description
reconnecting Boolean
Source:

parseBlock(st, handler)

Parameters:
Name Type Description
st Stream
handler GIFParserHandlers
Source:

parseBundle()

Given an XML element representing a user's OMEMO bundle, parse it and return a map.

Source:

parseCT(st, entries)

Parses GIF image color table information

Parameters:
Name Type Description
st Stream
entries Number
Source:

parseEncryptedMessage(stanza, attrs)

Hook handler for { @link parseMessage } and { @link parseMUCMessage }, which parses the passed in message stanza for OMEMO attributes and then sets them on the attrs object.

Parameters:
Name Type Description
stanza XMLElement

The message stanza

attrs MUCMessageAttributes | MessageAttributes
Source:
Returns:

(MUCMessageAttributes|MessageAttributes)

parseGIF(st, handler)

Takes a Stream and parses it for GIF data, calling the relevant handler methods on the passed in handler object.

Parameters:
Name Type Description
st Stream
handler GIFParserHandlers
Source:

parseHeader(st, callbackopt)

Parses GIF header information

Parameters:
Name Type Attributes Description
st Stream
callback function <optional>
Source:

parseImg(st, img, callbackopt)

Parses GIF image information

Parameters:
Name Type Attributes Description
st Stream
img ByteStream
callback function <optional>
Source:

parseMUCMessage(stanza, original_stanza, chatbox, _converse) → {Promise.<(MUCMessageAttributes|Error)>}

Parses a passed in message stanza and returns an object of attributes.

Parameters:
Name Type Description
stanza XMLElement

The message stanza

original_stanza XMLElement

The original stanza, that contains the message stanza, if it was contained, otherwise it's the message stanza itself.

chatbox _converse.ChatRoom
_converse _converse
Source:
Returns:
Type
Promise.<(MUCMessageAttributes|Error)>

parseMUCPresence(stanza, chatbox) → {MUCPresenceAttributes}

Parses a passed in MUC presence stanza and returns an object of attributes.

Parameters:
Name Type Description
stanza XMLElement

The presence stanza

chatbox _converse.ChatRoom
Source:
Returns:
Type
MUCPresenceAttributes

pause()

Pause the gif

Source:

play()

Start playing the gif

Source:

(async, private) populateRoster(ignore_cache)

Fetch all the roster groups, and then the roster contacts. Emit an event after fetching is done in each case.

Parameters:
Name Type Default Description
ignore_cache Bool false

If set to to true, the local cache will be ignored it's guaranteed that the XMPP server will be queried for the roster.

Source:

prefixMentions()

Given a message object, return its text with @ chars inserted before the mentioned nicknames.

Source:

publishDevices()

Send an IQ stanza to the current user's "devices" PEP node to ensure that all devices are published for potential chat partners to see. See: https://xmpp.org/extensions/xep-0384.html#usecases-announcing

Source:

putFrame(i)

Draws a gif frame at a specific index inside the canvas.

Parameters:
Name Type Description
i Number

The frame index

Source:

rejectPresenceSubscription(jid, message)

Reject or cancel another user's subscription to our presence updates.

Parameters:
Name Type Description
jid String

The Jabber ID of the user whose subscription is being canceled

message String

An optional message to the user

Source:

(private) removeResource(name:)

Remove the passed in resource from the resources map. Also redetermines the presence given that there's one less resource.

Parameters:
Name Type Description
name: string

The resource name

Source:

scrollDown(evopt)

Scrolls the chat down.

This method will always scroll the chat down, regardless of whether the user scrolled up manually or not.

Parameters:
Name Type Attributes Description
ev Event <optional>

An optional event that is the cause for needing to scroll down.

Source:

(private) sendAffiliationIQ(affiliation:, muc_jid:, member:)

Send an IQ stanza specifying an affiliation change.

Parameters:
Name Type Description
affiliation: String

affiliation (could also be stored on the member object).

muc_jid: String

The JID of the MUC in which the affiliation should be set.

member: Object

Map containing the member's jid and optionally a reason and affiliation.

Source:

sendCSI(stat)

Send out a Client State Indication (XEP-0352)

Parameters:
Name Type Description
stat String

The user's chat status

Source:

sendMarker(to_jid, id, type, msg_type)

Send out a XEP-0333 chat marker

Parameters:
Name Type Description
to_jid String
id String

The id of the message being marked

type String

The marker type

msg_type String
Source:

sendMarkerForLastMessage(typeopt, force)

Finds the last eligible message and then sends a XEP-0333 chat marker for it.

Parameters:
Name Type Attributes Default Description
type 'received' | 'displayed' | 'acknowledged' <optional>
'displayed'
force Boolean

Whether a marker should be sent for the message, even if it didn't include a markable element.

Source:

sendMarkerForLastMessage(typeopt, force)

Finds the last eligible message and then sends a XEP-0333 chat marker for it.

Parameters:
Name Type Attributes Default Description
type 'received' | 'displayed' | 'acknowledged' <optional>
'displayed'
force Boolean

Whether a marker should be sent for the message, even if it didn't include a markable element.

Source:

sendMarkerForMessage(msg, typeopt, force)

Given the passed in message object, send a XEP-0333 chat marker.

Parameters:
Name Type Attributes Default Description
msg _converse.Message
type 'received' | 'displayed' | 'acknowledged' <optional>
'displayed'
force Boolean

Whether a marker should be sent for the message, even if it didn't include a markable element.

Source:

sendMarkerForMessage(msg, typeopt, force)

Given the passed in message object, send a XEP-0333 chat marker.

Parameters:
Name Type Attributes Default Description
msg _converse.Message
type 'received' | 'displayed' | 'acknowledged' <optional>
'displayed'
force Boolean

Whether a marker should be sent for the message, even if it didn't include a markable element.

Source:

setAffiliation(affiliation, jids, members) → {Promise}

Send IQ stanzas to the server to set an affiliation for the provided JIDs. See: https://xmpp.org/extensions/xep-0045.html#modifymember

Prosody doesn't accept multiple JIDs' affiliations being set in one IQ stanza, so as a workaround we send a separate stanza for each JID. Related ticket: https://issues.prosody.im/345

Parameters:
Name Type Description
affiliation 'outcast' | 'member' | 'admin' | 'owner'

The affiliation to be set

jids String | Array.<String>

The JID(s) of the MUCs in which the affiliations need to be set.

members object

A map of jids, affiliations and optionally reasons. Only those entries with the same affiliation as being currently set will be considered.

Source:
Returns:

A promise which resolves and fails depending on the XMPP server response.

Type
Promise

setAffiliations(users) → {Promise}

Send IQ stanzas to the server to modify affiliations for users in this groupchat. See: https://xmpp.org/extensions/xep-0045.html#modifymember

Parameters:
Name Type Description
users Array.<Object>
Properties
Name Type Attributes Description
jid string

The JID of the user whose affiliation will change

affiliation Array

The new affiliation for this user

reason string <optional>

An optional reason for the affiliation change

Source:
Returns:
Type
Promise

setUserJID()

Stores the passed in JID for the current user, potentially creating a resource if the JID is bare.

Given that we can only create an XMPP connection if we know the domain of the server connect to and we only know this once we know the JID, we also call _converse.initConnection (if necessary) to make sure that the connection is set up.

Source:
Fires:

(private) shouldNotifyOfGroupMessage(attrs)

Is this a group message for which we should notify the user?

Parameters:
Name Type Description
attrs MUCMessageAttributes
Source:

(async, private) shouldNotifyOfMessage(data)

Parameters:
Name Type Description
data MessageData | MUCMessageData
Source:

showChatStateNotification()

Creates an HTML5 Notification to inform of a change in a contact's chat state.

Source:

(private) showMessageNotification(data)

Shows an HTML5 Notification with the passed in message

Parameters:
Name Type Description
data MessageData | MUCMessageData
Source:

startParsing(data)

Starts parsing the GIF stream data by calling parseGIF and passing in a map of handler functions.

Parameters:
Name Type Description
data String

The GIF file data, as returned by the server

Source:

throwErrorIfInvalidForward(stanza)

Check whether the passed-in stanza is a forwarded message that is "bare", i.e. it's not forwarded as part of a larger protocol, like MAM.

Parameters:
Name Type Description
stanza XMLElement
Source:

toggleRoomInfo()

Show/hide extra information about a groupchat in a listing.

Parameters:
Type Description
Event
Source:

updateSettingsWithFormData(form, settings)

Given the login <form> element, parse its data and update the converse settings with the supplied JID, password and connection URL.

Parameters:
Name Type Description
form HTMLElement
settings Object

Extra settings that may be passed in and will also be set together with the form settings.

Source:

withProgress()

Source:

Type Definitions

ArchiveQueryOptions

The options that can be passed in to the _converse.api.archive.query method

Type:
  • module:converse-mam~MAMFilterParameters
Properties:
Name Type Attributes Default Description
groupchat Boolean <optional>
false

Whether the MAM archive is for a groupchat.

Source:

ConfigurationSettings

Converse's core configuration values

Type:
  • Object
Properties:
Name Type Attributes Default Description
allow_non_roster_messaging Boolean <optional>
false
allow_url_history_change Boolean <optional>
true
assets_path String <optional>
'/dist'
authentication 'login' | 'prebind' | 'anonymous' | 'external' <optional>
'login'
auto_login Boolean <optional>
false

Currently only used in connection with anonymous login

auto_reconnect Boolean <optional>
true
blacklisted_plugins Array.<String> <optional>
clear_cache_on_logout Boolean <optional>
false
connection_options Object <optional>
credentials_url String <optional>

URL from where login credentials can be fetched

discover_connection_methods Boolean <optional>
true
geouri_regex RegExp <optional>
geouri_replacement RegExp <optional>
'https - //www.openstreetmap.org/?mlat=$1&mlon=$2#map=18/$1/$2'
i18n String <optional>
jid String <optional>
keepalive Boolean <optional>
true
loglevel 'debug' | 'info' | 'eror' <optional>
'info'
locales Array.<String> <optional>
nickname String <optional>
password String <optional>
persistent_store 'IndexedDB' | 'localStorage' <optional>
'IndexedDB'
rid String <optional>
root Element <optional>
window.document
sid String <optional>
singleton Boolean <optional>
false
strict_plugin_dependencies Boolean <optional>
false
view_mode 'overlayed' | 'fullscreen' | 'mobile' <optional>
'overlayed'
websocket_url String <optional>
whitelisted_plugins Array.<String> <optional>
Source:

ConfigurationSettings

Converse's core configuration values

Type:
  • Object
Properties:
Name Type Attributes Default Description
allow_non_roster_messaging Boolean <optional>
false
allow_url_history_change Boolean <optional>
true
assets_path String <optional>
'/dist'
authentication 'login' | 'prebind' | 'anonymous' | 'external' <optional>
'login'
auto_login Boolean <optional>
false

Currently only used in connection with anonymous login

auto_reconnect Boolean <optional>
true
blacklisted_plugins Array.<String> <optional>
clear_cache_on_logout Boolean <optional>
false
connection_options Object <optional>
credentials_url String <optional>

URL from where login credentials can be fetched

discover_connection_methods Boolean <optional>
true
geouri_regex RegExp <optional>
geouri_replacement RegExp <optional>
'https - //www.openstreetmap.org/?mlat=$1&mlon=$2#map=18/$1/$2'
i18n String <optional>
jid String <optional>
keepalive Boolean <optional>
true
loglevel 'debug' | 'info' | 'eror' <optional>
'info'
locales Array.<String> <optional>
nickname String <optional>
password String <optional>
persistent_store 'IndexedDB' | 'localStorage' <optional>
'IndexedDB'
rid String <optional>
root Element <optional>
window.document
sid String <optional>
singleton Boolean <optional>
false
strict_plugin_dependencies Boolean <optional>
false
view_mode 'overlayed' | 'fullscreen' | 'mobile' <optional>
'overlayed'
websocket_url String <optional>
whitelisted_plugins Array.<String> <optional>
Source:

ConverseGIFComponentProperties

Type:
  • Object
Properties:
Name Type Description
autoplay Boolean
noloop Boolean
progress_color String
nick String
fallback 'url' | 'empty' | 'error'
src String
Source:

GIFParserHandlers

A map of callback functions passed parseGIF. These functions are called as various parts of the GIF file format are parsed.

Type:
  • Object
Properties:
Name Type Description
hdr function

Callback to handle the GIF header data

gce function

Callback to handle the GIF Graphic Control Extension data

com function

Callback to handle the comment extension block

img function

Callback to handle image data

eof function

Callback once the end of file has been reached

Source:

HeadingButtonAttributes

An object representing a chat heading button

Type:
  • Object
Properties:
Name Type Description
standalone Boolean

True if shown on its own, false if it must be in the dropdown menu.

handler function

A handler function to be called when the button is clicked.

a_class String

HTML classes to show on the button

i18n_text String

The user-visiible name of the button

i18n_title String

The tooltip text for this button

icon_class String

What kind of CSS class to use for the icon

name String

The internal name of the button

Source:

MAMFilterParameters

Filter parameters which can be used to filter a MAM XEP-0313 archive

Type:
Properties:
Name Type Attributes Description
end String <optional>

A date string in ISO-8601 format, before which messages should be returned. Implies backward paging.

start String <optional>

A date string in ISO-8601 format, after which messages should be returned. Implies forward paging.

with String <optional>

A JID against which to match messages, according to either their to or from attributes. An item in a MUC archive matches if the publisher of the item matches the JID. If with is omitted, all messages that match the rest of the query will be returned, regardless of to/from addresses of each message.

Source:

MAMOptions

A map of MAM related options that may be passed to fetchArchivedMessages

Type:
  • Object
Source:

MAMQueryResult

Type:
  • Object
Properties:
Name Type Attributes Description
messages Array
rsm RSM <optional>

An instance of RSM. You can call next() or previous() on this instance, to get the RSM query parameters for the next or previous page in the result set.

complete Boolean
error Error <optional>
Source:

MediaURLData

An object representing a URL found in a chat message

Type:
  • Object
Properties:
Name Type Description
is_audio Boolean
is_image Boolean
is_video Boolean
end String
start String
url String
Source:

MediaURLData

An object representing a URL found in a chat message

Type:
  • Object
Properties:
Name Type Description
is_audio Boolean
is_image Boolean
is_video Boolean
end String
start String
url String
Source:

MediaURLMetadata

An object representing the metadata of a URL found in a chat message The actual URL is not saved, it can be extracted via the start and end indexes.

Type:
  • Object
Properties:
Name Type Description
is_audio Boolean
is_image Boolean
is_video Boolean
end String
start String
Source:

MediaURLMetadata

An object representing the metadata of a URL found in a chat message The actual URL is not saved, it can be extracted via the start and end indexes.

Type:
  • Object
Properties:
Name Type Description
is_audio Boolean
is_image Boolean
is_video Boolean
end String
start String
Source:

MemberListItem

Either the JID or the nickname (or both) will be available.

Type:
  • Object
Properties:
Name Type Attributes Description
affiliation string
role string <optional>
jid string <optional>
nick string <optional>
Source:

MessageActionAttributes

An object which represents a message action (as shown in the message dropdown);

Type:
  • Object
Properties:
Name Type Description
i18n_text String
handler function
button_class String
icon_class String
name String
Source:

MessageAttributes

The object which parseMessage returns

Type:
  • Object
Properties:
Name Type Description
sender 'me' | 'them'

Whether the message was sent by the current user or someone else

references Array.<Object>

A list of objects representing XEP-0372 references

editable Boolean

Is this message editable via XEP-0308?

is_archived Boolean

Is this message from a XEP-0313 MAM archive?

is_carbon Boolean

Is this message a XEP-0280 Carbon?

is_delayed Boolean

Was delivery of this message was delayed as per XEP-0203?

is_encrypted Boolean

Is this message XEP-0384 encrypted?

is_error Boolean

Whether an error was received for this message

is_headline Boolean

Is this a "headline" message?

is_markable Boolean

Can this message be marked with a XEP-0333 chat marker?

is_marker Boolean

Is this message a XEP-0333 Chat Marker?

is_only_emojis Boolean

Does the message body contain only emojis?

is_spoiler Boolean

Is this a XEP-0382 spoiler message?

is_tombstone Boolean

Is this a XEP-0424 tombstone?

is_unstyled Boolean

Whether XEP-0393 styling hints should be ignored

is_valid_receipt_request Boolean

Does this message request a XEP-0184 receipt (and is not from us or a carbon or archived message)

encrypted Object

XEP-0384 encryption payload attributes

body String

The contents of the tag of the message stanza

chat_state String

The XEP-0085 chat state notification contained in this message

contact_jid String

The JID of the other person or entity

edited String

An ISO8601 string recording the time that the message was edited per XEP-0308

error_condition String

The defined error condition

error_text String

The error text received from the server

error_type String

The type of error received from the server

from String

The sender JID

fullname String

The full name of the sender

marker String

The XEP-0333 Chat Marker value

marker_id String

The id attribute of a XEP-0333 chat marker

msgid String

The root id attribute of the stanza

nick String

The roster nickname of the sender

oob_desc String

The description of the XEP-0066 out of band data

oob_url String

The URL of the XEP-0066 out of band data

origin_id String

The XEP-0359 Origin ID

receipt_id String

The id attribute of a XEP-0184 element

received String

An ISO8601 string recording the time that the message was received

replace_id String

The id attribute of a XEP-0308 element

retracted String

An ISO8601 string recording the time that the message was retracted

retracted_id String

The id attribute of a XEP-424 element

spoiler_hint String

The XEP-0382 spoiler hint

stanza_id String

The XEP-0359 Stanza ID. Note: the key is actualy stanza_id ${by_jid} and there can be multiple.

subject String

The element value

thread String

The element value

time String

The time (in ISO8601 format), either given by the XEP-0203 element, or of receipt.

to String

The recipient JID

type String

The type of message

Source:

MessageAttributes

The object which parseMessage returns

Type:
  • Object
Properties:
Name Type Description
sender 'me' | 'them'

Whether the message was sent by the current user or someone else

references Array.<Object>

A list of objects representing XEP-0372 references

editable Boolean

Is this message editable via XEP-0308?

is_archived Boolean

Is this message from a XEP-0313 MAM archive?

is_carbon Boolean

Is this message a XEP-0280 Carbon?

is_delayed Boolean

Was delivery of this message was delayed as per XEP-0203?

is_encrypted Boolean

Is this message XEP-0384 encrypted?

is_error Boolean

Whether an error was received for this message

is_headline Boolean

Is this a "headline" message?

is_markable Boolean

Can this message be marked with a XEP-0333 chat marker?

is_marker Boolean

Is this message a XEP-0333 Chat Marker?

is_only_emojis Boolean

Does the message body contain only emojis?

is_spoiler Boolean

Is this a XEP-0382 spoiler message?

is_tombstone Boolean

Is this a XEP-0424 tombstone?

is_unstyled Boolean

Whether XEP-0393 styling hints should be ignored

is_valid_receipt_request Boolean

Does this message request a XEP-0184 receipt (and is not from us or a carbon or archived message)

encrypted Object

XEP-0384 encryption payload attributes

body String

The contents of the tag of the message stanza

chat_state String

The XEP-0085 chat state notification contained in this message

contact_jid String

The JID of the other person or entity

edited String

An ISO8601 string recording the time that the message was edited per XEP-0308

error_condition String

The defined error condition

error_text String

The error text received from the server

error_type String

The type of error received from the server

from String

The sender JID

fullname String

The full name of the sender

marker String

The XEP-0333 Chat Marker value

marker_id String

The id attribute of a XEP-0333 chat marker

msgid String

The root id attribute of the stanza

nick String

The roster nickname of the sender

oob_desc String

The description of the XEP-0066 out of band data

oob_url String

The URL of the XEP-0066 out of band data

origin_id String

The XEP-0359 Origin ID

receipt_id String

The id attribute of a XEP-0184 element

received String

An ISO8601 string recording the time that the message was received

replace_id String

The id attribute of a XEP-0308 element

retracted String

An ISO8601 string recording the time that the message was retracted

retracted_id String

The id attribute of a XEP-424 element

spoiler_hint String

The XEP-0382 spoiler hint

stanza_id String

The XEP-0359 Stanza ID. Note: the key is actualy stanza_id ${by_jid} and there can be multiple.

subject String

The element value

thread String

The element value

time String

The time (in ISO8601 format), either given by the XEP-0203 element, or of receipt.

to String

The recipient JID

type String

The type of message

Source:

MessageData

An object containing the original message stanza, as well as the parsed attributes.

Type:
  • Object
Properties:
Name Type Description
stanza XMLElement
stanza MessageAttributes
chatbox ChatBox
Source:

MessageData

An object containing the original message stanza, as well as the parsed attributes.

Type:
  • Object
Properties:
Name Type Description
stanza XMLElement
stanza MessageAttributes
chatbox ChatBox
Source:

MUCHat

Object representing a XEP-0371 Hat

Type:
  • Object
Properties:
Name Type Description
title String
uri String
Source:

MUCMessageAttributes

The object which parseMUCMessage returns

Type:
  • Object
Properties:
Name Type Description
sender 'me' | 'them'

Whether the message was sent by the current user or someone else

activities Array.<Object>

A list of objects representing XEP-0316 MEP notification data

references Array.<Object>

A list of objects representing XEP-0372 references

editable Boolean

Is this message editable via XEP-0308?

is_archived Boolean

Is this message from a XEP-0313 MAM archive?

is_carbon Boolean

Is this message a XEP-0280 Carbon?

is_delayed Boolean

Was delivery of this message was delayed as per XEP-0203?

is_encrypted Boolean

Is this message XEP-0384 encrypted?

is_error Boolean

Whether an error was received for this message

is_headline Boolean

Is this a "headline" message?

is_markable Boolean

Can this message be marked with a XEP-0333 chat marker?

is_marker Boolean

Is this message a XEP-0333 Chat Marker?

is_only_emojis Boolean

Does the message body contain only emojis?

is_spoiler Boolean

Is this a XEP-0382 spoiler message?

is_tombstone Boolean

Is this a XEP-0424 tombstone?

is_unstyled Boolean

Whether XEP-0393 styling hints should be ignored

is_valid_receipt_request Boolean

Does this message request a XEP-0184 receipt (and is not from us or a carbon or archived message)

encrypted Object

XEP-0384 encryption payload attributes

body String

The contents of the tag of the message stanza

chat_state String

The XEP-0085 chat state notification contained in this message

edited String

An ISO8601 string recording the time that the message was edited per XEP-0308

error_condition String

The defined error condition

error_text String

The error text received from the server

error_type String

The type of error received from the server

from String

The sender JID (${muc_jid}/${nick})

from_muc String

The JID of the MUC from which this message was sent

from_real_jid String

The real JID of the sender, if available

fullname String

The full name of the sender

marker String

The XEP-0333 Chat Marker value

marker_id String

The id attribute of a XEP-0333 chat marker

moderated String

The type of XEP-0425 moderation (if any) that was applied

moderated_by String

The JID of the user that moderated this message

moderated_id String

The XEP-0359 Stanza ID of the message that this one moderates

moderation_reason String

The reason provided why this message moderates another

msgid String

The root id attribute of the stanza

nick String

The MUC nickname of the sender

occupant_id String

The XEP-0421 occupant ID

oob_desc String

The description of the XEP-0066 out of band data

oob_url String

The URL of the XEP-0066 out of band data

origin_id String

The XEP-0359 Origin ID

receipt_id String

The id attribute of a XEP-0184 element

received String

An ISO8601 string recording the time that the message was received

replace_id String

The id attribute of a XEP-0308 element

retracted String

An ISO8601 string recording the time that the message was retracted

retracted_id String

The id attribute of a XEP-424 element

spoiler_hint String

The XEP-0382 spoiler hint

stanza_id String

The XEP-0359 Stanza ID. Note: the key is actualy stanza_id ${by_jid} and there can be multiple.

subject String

The element value

thread String

The element value

time String

The time (in ISO8601 format), either given by the XEP-0203 element, or of receipt.

to String

The recipient JID

type String

The type of message

Source:

MUCMessageData

An object containing the parsed MUCMessageAttributes and current ChatRoom.

Type:
  • Object
Properties:
Name Type Description
attrs MUCMessageAttributes
chatbox ChatRoom
Source:

MUCPresenceAttributes

The object which parseMUCPresence returns

Type:
  • Object
Properties:
Name Type Description
show "offline|online"
hats Array.<MUCHat>

An array of XEP-0317 hats

states Array.<string>
from String

The sender JID (${muc_jid}/${nick})

nick String

The nickname of the sender

occupant_id String

The XEP-0421 occupant ID

type String

The type of presence

Source:

OccupantData

Type:
  • Object
Properties:
Name Type Attributes Description
jid String <optional>
nick String <optional>
occupant_id String <optional>
Source:

RichTextComponentProperties

Type:
  • Object
Properties:
Name Type Description
embed_audio Boolean

Whether URLs that point to audio files should render as audio players.

embed_videos Boolean

Whether URLs that point to video files should render as video players.

mentions Array

An array of objects representing chat mentions

nick String

The current user's nickname, relevant for mentions

offset Number

The text offset, in case this is a nested RichText element.

onImgClick function
onImgLoad function
render_styling Boolean

Whether XEP-0393 message styling hints should be rendered

show_images Boolean

Whether URLs that point to image files should render as images

hide_media_urls Boolean

If media URLs are rendered as media, then this option determines whether the original URL is also still shown or not. Only relevant in conjunction with show_images, embed_audio and embed_videos.

show_me_message Boolean

Whether text that starts with /me should be rendered in the 3rd person.

text String

The text that will get transformed.

Source:

Events

converse-loaded

Once Converse.js has loaded, it'll dispatch a custom event with the name converse-loaded. You can listen for this event in order to be informed as soon as converse.js has been loaded and parsed, which would mean it's safe to call converse.initialize.

Source:
Example
window.addEventListener('converse-loaded', () => converse.initialize());