Options
Menu

Class ChatRoom

A ChatRoom is a chat construct where users must be connected and present to receive messages. A chat room does not have members beyond who is in the chat room at any given time. Presence in a chat room is determined by session. If a particular session is not connected and currently in a given room, then messages published to that room will not be delivered to that session.

If your session is disconnected while joined to a ChatRoom, you will automatically rejoin when connectivity is restored.

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

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.

leave

  • leave(): Promise<void>
  • Leaves the chat, such that messages will no longer be received. The semantics of this depend on the specific subclass.

    Returns Promise<void>

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

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

remove

  • Removes the specified user from the Chat.

    Parameters

    Returns Promise<void>

    A promise that is resolved when the specified user is successfully removed from the 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.