Converse converse.js

Namespace: rooms

rooms

The "rooms" namespace groups methods relevant to chatrooms (aka groupchats).

Source:

Namespaces

affiliations
affiliations

Methods

(static) create(jid|jids, attrsopt) → {Promise}

Creates a new MUC chatroom (aka groupchat)

Similar to api.rooms.open, but creates the chatroom in the background (i.e. doesn't cause a view to open).

Parameters:
Name Type Attributes Description
jid|jids Array.<string> | string

The JID or array of JIDs of the chatroom(s) to create

attrs object <optional>

attrs The room attributes

Source:
Returns:

Promise which resolves with the Model representing the chat.

Type
Promise

(static) create(jid|jids, attrsopt) → {Promise}

Creates a new MUC chatroom (aka groupchat)

Similar to api.rooms.open, but creates the chatroom in the background (i.e. doesn't cause a view to open).

Parameters:
Name Type Attributes Description
jid|jids Array.<string> | string

The JID or array of JIDs of the chatroom(s) to create

attrs object <optional>

attrs The room attributes

Source:
Returns:

Promise which resolves with the Model representing the chat.

Type
Promise

(static) get(jidopt, attrsopt, create) → {Promise.<_converse.ChatRoom>}

Fetches the object representing a MUC chatroom (aka groupchat)

Parameters:
Name Type Attributes Description
jid String <optional>

The room JID (if not specified, all rooms will be returned).

attrs Object <optional>

A map containing any extra room attributes to be set if create is set to true

Properties
Name Type Attributes Description
nick String <optional>

Specify the nickname

password String <optional>

Specify a password if needed to enter a new room

create Boolean

A boolean indicating whether the room should be created if not found (default: false)

Source:
Returns:
Type
Promise.<_converse.ChatRoom>
Example
api.waitUntil('roomsAutoJoined').then(() => {
    const create_if_not_found = true;
    api.rooms.get(
        'group@muc.example.com',
        {'nick': 'dread-pirate-roberts', 'password': 'secret'},
        create_if_not_found
    )
});

(static) get(jidopt, attrsopt, create) → {Promise.<_converse.ChatRoom>}

Fetches the object representing a MUC chatroom (aka groupchat)

Parameters:
Name Type Attributes Description
jid String <optional>

The room JID (if not specified, all rooms will be returned).

attrs Object <optional>

A map containing any extra room attributes to be set if create is set to true

Properties
Name Type Attributes Description
nick String <optional>

Specify the nickname

password String <optional>

Specify a password if needed to enter a new room

create Boolean

A boolean indicating whether the room should be created if not found (default: false)

Source:
Returns:
Type
Promise.<_converse.ChatRoom>
Example
api.waitUntil('roomsAutoJoined').then(() => {
    const create_if_not_found = true;
    api.rooms.get(
        'group@muc.example.com',
        {'nick': 'dread-pirate-roberts', 'password': 'secret'},
        create_if_not_found
    )
});

(static) open(jid, attrs, forceopt) → {Promise}

Opens a MUC chatroom (aka groupchat)

Similar to api.chats.open, but for groupchats.

Parameters:
Name Type Attributes Default Description
jid string

The room JID or JIDs (if not specified, all currently open rooms will be returned).

attrs string

A map containing any extra room attributes.

Properties
Name Type Attributes Description
nick string <optional>

The current user's nickname for the MUC

auto_configure boolean <optional>

A boolean, indicating whether the room should be configured automatically or not. If set to true, then it makes sense to pass in configuration settings.

roomconfig object <optional>

A map of configuration settings to be used when the room gets configured automatically. Currently it doesn't make sense to specify roomconfig values if auto_configure is set to false. For a list of configuration values that can be passed in, refer to these values in the XEP-0045 MUC specification. The values should be named without the muc#roomconfig_ prefix.

minimized boolean <optional>

A boolean, indicating whether the room should be opened minimized or not.

bring_to_foreground boolean <optional>

A boolean indicating whether the room should be brought to the foreground and therefore replace the currently shown chat. If there is no chat currently open, then this option is ineffective.

force Boolean <optional>
false

By default, a minimized room won't be maximized (in overlayed view mode) and in fullscreen view mode a newly opened room won't replace another chat already in the foreground. Set force to true if you want to force the room to be maximized or shown.

Source:
Returns:

Promise which resolves with the Model representing the chat.

Type
Promise
Examples
api.rooms.open('group@muc.example.com')
// To return an array of rooms, provide an array of room JIDs:
api.rooms.open(['group1@muc.example.com', 'group2@muc.example.com'])
// To setup a custom nickname when joining the room, provide the optional nick argument:
api.rooms.open('group@muc.example.com', {'nick': 'mycustomnick'})
// For example, opening a room with a specific default configuration:
api.rooms.open(
    'myroom@conference.example.org',
    { 'nick': 'coolguy69',
      'auto_configure': true,
      'roomconfig': {
          'changesubject': false,
          'membersonly': true,
          'persistentroom': true,
          'publicroom': true,
          'roomdesc': 'Comfy room for hanging out',
          'whois': 'anyone'
      }
    }
);

(static) open(jid, attrs, forceopt) → {Promise}

Opens a MUC chatroom (aka groupchat)

Similar to api.chats.open, but for groupchats.

Parameters:
Name Type Attributes Default Description
jid string

The room JID or JIDs (if not specified, all currently open rooms will be returned).

attrs string

A map containing any extra room attributes.

Properties
Name Type Attributes Description
nick string <optional>

The current user's nickname for the MUC

auto_configure boolean <optional>

A boolean, indicating whether the room should be configured automatically or not. If set to true, then it makes sense to pass in configuration settings.

roomconfig object <optional>

A map of configuration settings to be used when the room gets configured automatically. Currently it doesn't make sense to specify roomconfig values if auto_configure is set to false. For a list of configuration values that can be passed in, refer to these values in the XEP-0045 MUC specification. The values should be named without the muc#roomconfig_ prefix.

minimized boolean <optional>

A boolean, indicating whether the room should be opened minimized or not.

bring_to_foreground boolean <optional>

A boolean indicating whether the room should be brought to the foreground and therefore replace the currently shown chat. If there is no chat currently open, then this option is ineffective.

force Boolean <optional>
false

By default, a minimized room won't be maximized (in overlayed view mode) and in fullscreen view mode a newly opened room won't replace another chat already in the foreground. Set force to true if you want to force the room to be maximized or shown.

Source:
Returns:

Promise which resolves with the Model representing the chat.

Type
Promise
Examples
api.rooms.open('group@muc.example.com')
// To return an array of rooms, provide an array of room JIDs:
api.rooms.open(['group1@muc.example.com', 'group2@muc.example.com'])
// To setup a custom nickname when joining the room, provide the optional nick argument:
api.rooms.open('group@muc.example.com', {'nick': 'mycustomnick'})
// For example, opening a room with a specific default configuration:
api.rooms.open(
    'myroom@conference.example.org',
    { 'nick': 'coolguy69',
      'auto_configure': true,
      'roomconfig': {
          'changesubject': false,
          'membersonly': true,
          'persistentroom': true,
          'publicroom': true,
          'roomdesc': 'Comfy room for hanging out',
          'whois': 'anyone'
      }
    }
);

rooms

The "rooms" namespace groups methods relevant to chatrooms (aka groupchats).

Source:

Namespaces

affiliations
affiliations

Methods

(static) create(jid|jids, attrsopt) → {Promise}

Creates a new MUC chatroom (aka groupchat)

Similar to api.rooms.open, but creates the chatroom in the background (i.e. doesn't cause a view to open).

Parameters:
Name Type Attributes Description
jid|jids Array.<string> | string

The JID or array of JIDs of the chatroom(s) to create

attrs object <optional>

attrs The room attributes

Source:
Returns:

Promise which resolves with the Model representing the chat.

Type
Promise

(static) create(jid|jids, attrsopt) → {Promise}

Creates a new MUC chatroom (aka groupchat)

Similar to api.rooms.open, but creates the chatroom in the background (i.e. doesn't cause a view to open).

Parameters:
Name Type Attributes Description
jid|jids Array.<string> | string

The JID or array of JIDs of the chatroom(s) to create

attrs object <optional>

attrs The room attributes

Source:
Returns:

Promise which resolves with the Model representing the chat.

Type
Promise

(static) get(jidopt, attrsopt, create) → {Promise.<_converse.ChatRoom>}

Fetches the object representing a MUC chatroom (aka groupchat)

Parameters:
Name Type Attributes Description
jid String <optional>

The room JID (if not specified, all rooms will be returned).

attrs Object <optional>

A map containing any extra room attributes to be set if create is set to true

Properties
Name Type Attributes Description
nick String <optional>

Specify the nickname

password String <optional>

Specify a password if needed to enter a new room

create Boolean

A boolean indicating whether the room should be created if not found (default: false)

Source:
Returns:
Type
Promise.<_converse.ChatRoom>
Example
api.waitUntil('roomsAutoJoined').then(() => {
    const create_if_not_found = true;
    api.rooms.get(
        'group@muc.example.com',
        {'nick': 'dread-pirate-roberts', 'password': 'secret'},
        create_if_not_found
    )
});

(static) get(jidopt, attrsopt, create) → {Promise.<_converse.ChatRoom>}

Fetches the object representing a MUC chatroom (aka groupchat)

Parameters:
Name Type Attributes Description
jid String <optional>

The room JID (if not specified, all rooms will be returned).

attrs Object <optional>

A map containing any extra room attributes to be set if create is set to true

Properties
Name Type Attributes Description
nick String <optional>

Specify the nickname

password String <optional>

Specify a password if needed to enter a new room

create Boolean

A boolean indicating whether the room should be created if not found (default: false)

Source:
Returns:
Type
Promise.<_converse.ChatRoom>
Example
api.waitUntil('roomsAutoJoined').then(() => {
    const create_if_not_found = true;
    api.rooms.get(
        'group@muc.example.com',
        {'nick': 'dread-pirate-roberts', 'password': 'secret'},
        create_if_not_found
    )
});

(static) open(jid, attrs, forceopt) → {Promise}

Opens a MUC chatroom (aka groupchat)

Similar to api.chats.open, but for groupchats.

Parameters:
Name Type Attributes Default Description
jid string

The room JID or JIDs (if not specified, all currently open rooms will be returned).

attrs string

A map containing any extra room attributes.

Properties
Name Type Attributes Description
nick string <optional>

The current user's nickname for the MUC

auto_configure boolean <optional>

A boolean, indicating whether the room should be configured automatically or not. If set to true, then it makes sense to pass in configuration settings.

roomconfig object <optional>

A map of configuration settings to be used when the room gets configured automatically. Currently it doesn't make sense to specify roomconfig values if auto_configure is set to false. For a list of configuration values that can be passed in, refer to these values in the XEP-0045 MUC specification. The values should be named without the muc#roomconfig_ prefix.

minimized boolean <optional>

A boolean, indicating whether the room should be opened minimized or not.

bring_to_foreground boolean <optional>

A boolean indicating whether the room should be brought to the foreground and therefore replace the currently shown chat. If there is no chat currently open, then this option is ineffective.

force Boolean <optional>
false

By default, a minimized room won't be maximized (in overlayed view mode) and in fullscreen view mode a newly opened room won't replace another chat already in the foreground. Set force to true if you want to force the room to be maximized or shown.

Source:
Returns:

Promise which resolves with the Model representing the chat.

Type
Promise
Examples
api.rooms.open('group@muc.example.com')
// To return an array of rooms, provide an array of room JIDs:
api.rooms.open(['group1@muc.example.com', 'group2@muc.example.com'])
// To setup a custom nickname when joining the room, provide the optional nick argument:
api.rooms.open('group@muc.example.com', {'nick': 'mycustomnick'})
// For example, opening a room with a specific default configuration:
api.rooms.open(
    'myroom@conference.example.org',
    { 'nick': 'coolguy69',
      'auto_configure': true,
      'roomconfig': {
          'changesubject': false,
          'membersonly': true,
          'persistentroom': true,
          'publicroom': true,
          'roomdesc': 'Comfy room for hanging out',
          'whois': 'anyone'
      }
    }
);

(static) open(jid, attrs, forceopt) → {Promise}

Opens a MUC chatroom (aka groupchat)

Similar to api.chats.open, but for groupchats.

Parameters:
Name Type Attributes Default Description
jid string

The room JID or JIDs (if not specified, all currently open rooms will be returned).

attrs string

A map containing any extra room attributes.

Properties
Name Type Attributes Description
nick string <optional>

The current user's nickname for the MUC

auto_configure boolean <optional>

A boolean, indicating whether the room should be configured automatically or not. If set to true, then it makes sense to pass in configuration settings.

roomconfig object <optional>

A map of configuration settings to be used when the room gets configured automatically. Currently it doesn't make sense to specify roomconfig values if auto_configure is set to false. For a list of configuration values that can be passed in, refer to these values in the XEP-0045 MUC specification. The values should be named without the muc#roomconfig_ prefix.

minimized boolean <optional>

A boolean, indicating whether the room should be opened minimized or not.

bring_to_foreground boolean <optional>

A boolean indicating whether the room should be brought to the foreground and therefore replace the currently shown chat. If there is no chat currently open, then this option is ineffective.

force Boolean <optional>
false

By default, a minimized room won't be maximized (in overlayed view mode) and in fullscreen view mode a newly opened room won't replace another chat already in the foreground. Set force to true if you want to force the room to be maximized or shown.

Source:
Returns:

Promise which resolves with the Model representing the chat.

Type
Promise
Examples
api.rooms.open('group@muc.example.com')
// To return an array of rooms, provide an array of room JIDs:
api.rooms.open(['group1@muc.example.com', 'group2@muc.example.com'])
// To setup a custom nickname when joining the room, provide the optional nick argument:
api.rooms.open('group@muc.example.com', {'nick': 'mycustomnick'})
// For example, opening a room with a specific default configuration:
api.rooms.open(
    'myroom@conference.example.org',
    { 'nick': 'coolguy69',
      'auto_configure': true,
      'roomconfig': {
          'changesubject': false,
          'membersonly': true,
          'persistentroom': true,
          'publicroom': true,
          'roomdesc': 'Comfy room for hanging out',
          'whois': 'anyone'
      }
    }
);