Home Reference Source
import {ChatManager} from '@quobis/sippojs'
public class | source

ChatManager

Provides access to methods for using chat. A Chat manager object is obtained by calling the Session#getChatManager method.

Events

  • chats - Emitted every time the chat list changes.
  • conferenceChats - Emitted every time the conference chats list changes.
  • file - Emitted every time a new chat message containing a file is received.
  • message - Emitted every time a new chat message is received.
  • messageDisplayed - Emitted every time messages are marked as displayed by this user.
  • supportChat - Emitted every time a support chat is received.
  • supportChats - Emitted every time the support chat list changes.

Example:

Getting chats
  const chatManager = await session.getChatManager();
  const chats = chatManager.getChats();
Obtaining an individual chat
  const chat = chatManager.getIndividualChat('alice@quobis');

Member Summary

Public Members
public

emitter: EventEmitter

Method Summary

Public Methods
public

async createChat(name: string, subject: string): Promise<Chat>

Creates a new group chat.

public

async createSupportChat(context: object): Promise<Chat>

Creates a support chat, which is a group chat where a agent is added in the moment of the creation.

public

Disables push notifications.

public

Enables push notifications.

public

Returns a list with all the chats except the associated with conference rooms.

public

Returns a list with chats associated to conference rooms.

public

Obtains the specified group chat.

public

getIndividualChat(participant: string): Chat

Obtains an individual chat with the specified user.

public

Returns a list with chats associated with support chats.

public

Sets the Push Notifications service type and token.

public

async suspend()

public

async sync()

Synchronizes latest chat messages from the sever and reorders the chat list.

Public Members

public emitter: EventEmitter source

Public Methods

public async createChat(name: string, subject: string): Promise<Chat> source

Creates a new group chat.

Params:

NameTypeAttributeDescription
name string
  • optional
  • default: ''

The name of the new group chat.

subject string
  • optional
  • default: ''

The subject of the new group chat.

Return:

Promise<Chat>

public async createSupportChat(context: object): Promise<Chat> source

Creates a support chat, which is a group chat where a agent is added in the moment of the creation.

Params:

NameTypeAttributeDescription
context object

Context of supportChat

Return:

Promise<Chat>

public disablePushNotifications(): Promise source

Disables push notifications.

Return:

Promise

public enablePushNotifications(): Promise source

Enables push notifications.

Return:

Promise

public getChats(): ImmutableList<Chat> source

Returns a list with all the chats except the associated with conference rooms.

Return:

ImmutableList<Chat>

public getConferenceChats(): ImmutableList<Chat> source

Returns a list with chats associated to conference rooms.

Return:

ImmutableList<Chat>

public getGroupChat(id: String): Chat source

Obtains the specified group chat.

Params:

NameTypeAttributeDescription
id String

Address of the group chat.

Return:

Chat

public getIndividualChat(participant: string): Chat source

Obtains an individual chat with the specified user.

Params:

NameTypeAttributeDescription
participant string

Address of the remote participant of the chat.

Return:

Chat

public getSupportChats(): ImmutableList<Chat> source

Returns a list with chats associated with support chats.

Return:

ImmutableList<Chat>

public setPushConfig(config: Object) source

Sets the Push Notifications service type and token.

Params:

NameTypeAttributeDescription
config Object
config.jid string

The bare JID of the Push Server (e.g.: push.sippo).

config.type "fcm" | "apn"

The type of the Push Server. Supported values are fcm and apn.

config.token string

The token obtained from the Push Service.

public async suspend() source

public async sync() source

Synchronizes latest chat messages from the sever and reorders the chat list. This method needs to be called after initialization and every time session is resumed.