Options
Menu

Class ChatService

The ChatService is the entry point for chat functionality. Chat is defined as textual communication limited to either a fixed set of participants, or a ChatRoom in which any members can send and receive messages.

See the developer guide for a few chat examples.

Hierarchy

Index

Properties

Events

Events: IChatServiceEvents = Events

Methods

addListener

create

  • Creates a new Chat. The specific type of Chat created will depend on the options provided.

    Parameters

    Returns Promise<string>

    A promise that will be resolved with the id of the successfully created Chat.

direct

  • Gets a DirectChat for the communication between the local user and another specified user.

    Parameters

    • user: string | DomainUserId

      The other user to get the DirectChat for.

    Returns Promise<DirectChat>

    A Promise resolved with the specified DirectChat.

  • Gets a DirectChat for the communication between the local user and a set of users.

    Parameters

    • users: (string | DomainUserId)[]

      The other users to get the DirectChat for.

    Returns Promise<DirectChat>

    A Promise resolved with the specified DirectChat.

  • Get multiple DirectChats for the communication between the local user and a sets of users.

    Parameters

    • userLists: (string | DomainUserId)[][]

      The lists of users that specify the direct chats to get.

    Returns Promise<DirectChat[]>

    A Promise resolved with the specified DirectChat.

events

  • Provides the events emitted by this object as an Observable stream.

    example
    
    eventEmitter.events()
      .filter(e => e.name === "myevent")
      .subscribe(e => console.log(e));
    

    Returns Observable<IChatEvent>

    An Observable stream of all events emitted by this object.

exists

  • exists(chatId: string): Promise<boolean>
  • exists(chatIds: string[]): Promise<Map<string, boolean>>
  • Determines if a Chat with the specified id exists.

    Parameters

    • chatId: string

      The chat id to check.

    Returns Promise<boolean>

    A promise resolved with true if the specified chat exists, or false otherwise.

  • Determines if a set of Chats with the specified ids exist.

    Parameters

    • chatIds: string[]

      The chat id to check.

    Returns Promise<Map<string, boolean>>

    A promise resolved with a map of chat id's to booleans that indicate of the chat exists.

get

  • get(chatIds: string[]): Promise<Map<string, Chat>>
  • get(chatId: string): Promise<Chat>
  • Gets a Chat object for the specified id. The exact subclass returned will depend on the type of Chat the id refers to.

    Parameters

    • chatIds: string[]

      The and array of the Chat ids to get.

    Returns Promise<Map<string, Chat>>

    A Promise that will be resolved with the specified Chat, if it exists.

  • Gets a Chat object for the specified id. The exact subclass returned will depend on the type of Chat the id refers to.

    Parameters

    • chatId: string

      The id of the Chat to get.

    Returns Promise<Chat>

    A Promise that will be resolved with the specified Chats, if they exists.

join

  • join(chatId: string): Promise<Chat>
  • Joins a Chat with the specified id. The Chat must already exist. The type of Chat returned will vary depending on what type of Chat the id refers to.

    Parameters

    • chatId: string

      The id of an existing Chat to join.

    Returns Promise<Chat>

    A Promise resolved with the successfully joined Chat.

joined

  • Gets the [[ChatInfo]] for currently joined Chats.

    Returns Promise<IChatInfo[]>

    A promise that is resolved with the joined chats.

leave

  • leave(chatId: string): Promise<void>
  • Leaves the specified Chat. The id must refer to an existing chat that the user is presently joined to.

    Parameters

    • chatId: string

      The id of the Chat to leave.

    Returns Promise<void>

    A Promise that will be resolved when the Chat is successfully left.

off

on

once

  • Adds a single shot event listener for the specified event. The listener will be called the first time the specified event is fired after the event registration occurs, after which the registration will be removed and no further events will be passed to the listener.

    Parameters

    Returns ConvergenceEventEmitter<IChatEvent>

    This object, in support of a fluent API.

permissions

remove

  • remove(chatId: string): Promise<void>
  • Removes the Chat with the specified id.

    Parameters

    • chatId: string

      The id of the Chat to remove.

    Returns Promise<void>

    A promise that will be resolved when the Chat is successfully removed.

removeAllListeners

removeListener

removeListeners

search

  • Searches for existing chats.

    Parameters

    Returns Promise<PagedData<IChatInfo>>

    Chat info objects for matching results.

session