Converse converse.js

Namespace: converse

converse

The Public API

This namespace contains public API methods which are are accessible on the global converse object. They are public, because any JavaScript in the page can call them. Public methods therefore don’t expose any sensitive or closured data. To do that, you’ll need to create a plugin, which has access to the private API method.

Source:

Namespaces

env
env
plugins
plugins

Methods

(async, static) initialize(config)

Public API method which initializes Converse. This method must always be called when using Converse.

Parameters:
Name Type Description
config object

A map of configuration-settings.

Source:
Example
converse.initialize({
    auto_list_rooms: false,
    auto_subscribe: false,
    bosh_service_url: 'https://bind.example.com',
    hide_muc_server: false,
    i18n: 'en',
    play_sounds: true,
    show_controlbox_by_default: true,
    debug: false,
    roster_groups: true
});

(async, static) initialize(config)

Public API method which initializes Converse. This method must always be called when using Converse.

Parameters:
Name Type Description
config object

A map of configuration-settings.

Source:
Example
converse.initialize({
    auto_list_rooms: false,
    auto_subscribe: false,
    bosh_service_url: 'https://bind.example.com',
    hide_muc_server: false,
    i18n: 'en',
    play_sounds: true,
    show_controlbox_by_default: true,
    debug: false,
    roster_groups: true
});

(async, static) insertInto()

Public API method which will ensure that the #conversejs element is inserted into a container element.

This method is useful when the #conversejs element has been detached from the DOM somehow.

Source:
Example
converse.insertInto(document.querySelector('#converse-container'));

(static) load(settings)

Public API method which explicitly loads Converse and allows you the possibility to pass in configuration settings which need to be defined before loading. Currently this is only the assets_path setting.

If not called explicitly, this method will be called implicitly once converse.initialize is called.

In most cases, you probably don't need to explicitly call this method, however, until converse.js has been loaded you won't have access to the utility methods and globals exposed via converse.env. So if you need to access converse.env outside of any plugins and before converse.initialize has been called, then you need to call converse.load first.

Parameters:
Name Type Description
settings object

A map of configuration-settings that are needed at load time.

Source:
Example
converse.load({assets_path: '/path/to/assets/'});

Type Definitions

ConverseEnv

Utility methods and globals from bundled 3rd party libraries.

Properties:
Name Type Description
converse.env.TimeoutError Error
converse.env.$build function

Creates a Strophe.Builder, for creating stanza objects.

converse.env.$iq function

Creates a Strophe.Builder with an element as the root.

converse.env.$msg function

Creates a Strophe.Builder with an element as the root.

converse.env.$pres function

Creates a Strophe.Builder with an element as the root.

converse.env.Promise function

The Promise implementation used by Converse.

converse.env.Strophe function

The Strophe XMPP library used by Converse.

converse.env.f function

And instance of Lodash with its methods wrapped to produce immutable auto-curried iteratee-first data-last methods.

converse.env.sizzle function

Sizzle CSS selector engine.

converse.env.sprintf function
converse.env._ object

The instance of lodash-es used by Converse.

converse.env.dayjs object

DayJS date manipulation library.

converse.env.utils object

Module containing common utility methods used by Converse.

Source:

ConverseEnv

Utility methods and globals from bundled 3rd party libraries.

Properties:
Name Type Description
converse.env.TimeoutError Error
converse.env.$build function

Creates a Strophe.Builder, for creating stanza objects.

converse.env.$iq function

Creates a Strophe.Builder with an element as the root.

converse.env.$msg function

Creates a Strophe.Builder with an element as the root.

converse.env.$pres function

Creates a Strophe.Builder with an element as the root.

converse.env.Promise function

The Promise implementation used by Converse.

converse.env.Strophe function

The Strophe XMPP library used by Converse.

converse.env.f function

And instance of Lodash with its methods wrapped to produce immutable auto-curried iteratee-first data-last methods.

converse.env.sizzle function

Sizzle CSS selector engine.

converse.env.sprintf function
converse.env._ object

The instance of lodash-es used by Converse.

converse.env.dayjs object

DayJS date manipulation library.

converse.env.utils object

Module containing common utility methods used by Converse.

Source:

converse

The Public API

This namespace contains public API methods which are are accessible on the global converse object. They are public, because any JavaScript in the page can call them. Public methods therefore don’t expose any sensitive or closured data. To do that, you’ll need to create a plugin, which has access to the private API method.

Source:

Namespaces

env
env
plugins
plugins

Methods

(async, static) initialize(config)

Public API method which initializes Converse. This method must always be called when using Converse.

Parameters:
Name Type Description
config object

A map of configuration-settings.

Source:
Example
converse.initialize({
    auto_list_rooms: false,
    auto_subscribe: false,
    bosh_service_url: 'https://bind.example.com',
    hide_muc_server: false,
    i18n: 'en',
    play_sounds: true,
    show_controlbox_by_default: true,
    debug: false,
    roster_groups: true
});

(async, static) initialize(config)

Public API method which initializes Converse. This method must always be called when using Converse.

Parameters:
Name Type Description
config object

A map of configuration-settings.

Source:
Example
converse.initialize({
    auto_list_rooms: false,
    auto_subscribe: false,
    bosh_service_url: 'https://bind.example.com',
    hide_muc_server: false,
    i18n: 'en',
    play_sounds: true,
    show_controlbox_by_default: true,
    debug: false,
    roster_groups: true
});

(async, static) insertInto()

Public API method which will ensure that the #conversejs element is inserted into a container element.

This method is useful when the #conversejs element has been detached from the DOM somehow.

Source:
Example
converse.insertInto(document.querySelector('#converse-container'));

(static) load(settings)

Public API method which explicitly loads Converse and allows you the possibility to pass in configuration settings which need to be defined before loading. Currently this is only the assets_path setting.

If not called explicitly, this method will be called implicitly once converse.initialize is called.

In most cases, you probably don't need to explicitly call this method, however, until converse.js has been loaded you won't have access to the utility methods and globals exposed via converse.env. So if you need to access converse.env outside of any plugins and before converse.initialize has been called, then you need to call converse.load first.

Parameters:
Name Type Description
settings object

A map of configuration-settings that are needed at load time.

Source:
Example
converse.load({assets_path: '/path/to/assets/'});

Type Definitions

ConverseEnv

Utility methods and globals from bundled 3rd party libraries.

Properties:
Name Type Description
converse.env.TimeoutError Error
converse.env.$build function

Creates a Strophe.Builder, for creating stanza objects.

converse.env.$iq function

Creates a Strophe.Builder with an element as the root.

converse.env.$msg function

Creates a Strophe.Builder with an element as the root.

converse.env.$pres function

Creates a Strophe.Builder with an element as the root.

converse.env.Promise function

The Promise implementation used by Converse.

converse.env.Strophe function

The Strophe XMPP library used by Converse.

converse.env.f function

And instance of Lodash with its methods wrapped to produce immutable auto-curried iteratee-first data-last methods.

converse.env.sizzle function

Sizzle CSS selector engine.

converse.env.sprintf function
converse.env._ object

The instance of lodash-es used by Converse.

converse.env.dayjs object

DayJS date manipulation library.

converse.env.utils object

Module containing common utility methods used by Converse.

Source:

ConverseEnv

Utility methods and globals from bundled 3rd party libraries.

Properties:
Name Type Description
converse.env.TimeoutError Error
converse.env.$build function

Creates a Strophe.Builder, for creating stanza objects.

converse.env.$iq function

Creates a Strophe.Builder with an element as the root.

converse.env.$msg function

Creates a Strophe.Builder with an element as the root.

converse.env.$pres function

Creates a Strophe.Builder with an element as the root.

converse.env.Promise function

The Promise implementation used by Converse.

converse.env.Strophe function

The Strophe XMPP library used by Converse.

converse.env.f function

And instance of Lodash with its methods wrapped to produce immutable auto-curried iteratee-first data-last methods.

converse.env.sizzle function

Sizzle CSS selector engine.

converse.env.sprintf function
converse.env._ object

The instance of lodash-es used by Converse.

converse.env.dayjs object

DayJS date manipulation library.

converse.env.utils object

Module containing common utility methods used by Converse.

Source: