Options
Menu

Class Chat

The Chat class is the base class of all Chat types in Convergence. It provides several methods and behaviors that are common to all Chat subclasses, such as the ability to send messages, set a name and topic, etc.

Hierarchy

Index

Properties

Events

Events: ChatEvents = Events

Methods

addListener

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.

getHistory

  • Get the history of events for this Chat. Events consist of messages, users joining / leaving, and a variety of other events depending on the chat type.

    Parameters

    Returns Promise<PagedData<ChatHistoryEntry>>

    A promise that will be resolved with an array of Chat events that match the specified search options.

info

  • Returns IChatInfo

    Information which describes the Chat. Subclasses may provide a more specific subclass of ChatInfo.

isJoined

  • isJoined(): boolean
  • Determines if the Chat is Joined. Chat's must be joined to perform many functions, such as sending messages.

    Returns boolean

    True if the chat is joined, false otherwise.

markSeen

  • markSeen(eventNumber: number): Promise<void>
  • Marks the specified event number as having been seen by the local user. It is assumed that all events prior or equal to this event have been seen by the user.

    Parameters

    • eventNumber: number

      The event number to mark as set.

    Returns Promise<void>

    A promise acknowledging that seen events have been marked successfully.

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

  • Returns the permissions manager for this chat.

    Returns ChatPermissionManager

    the permissions manager for this chat.

removeAllListeners

removeListener

removeListeners

send

  • Publishes a chat message to this Chat.

    Parameters

    • message: string

      The message to send.

    Returns Promise<IChatMessageResponse>

    A promise acknowledging that the message has been received by the server.

session

setName

  • setName(name: string): Promise<void>
  • Sets the short descriptive name for this chat.

    Parameters

    • name: string

      The name to set.

    Returns Promise<void>

    A promise acknowledging that the name has been successfully set.

setTopic

  • setTopic(topic: string): Promise<void>
  • Sets the the current topic being discussed in the chat.

    Parameters

    • topic: string

      The topic to set.

    Returns Promise<void>

    A promise acknowledging that the topic has been successfully set.