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

plugins

Members

(static) env

Utility methods and globals from bundled 3rd party libraries.

Properties:
Name Type Description
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.Backbone object

The Backbone object used by Converse to create models and views.

converse.env.Promise function

The Promise implementation used by Converse.

converse.env.Strophe function

The Strophe XMPP library used by Converse.

converse.env._ object

The instance of lodash 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.dayjs object

DayJS date manipulation library.

converse.env.sizzle function

Sizzle CSS selector engine.

converse.env.utils object

Module containing common utility methods used by Converse.

Source:

Methods

(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
});

(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/'});