A MembershipChat chat is a chat construct that has a specific set of users who belong to that chat. A MembershipChat keeps track of which users are part of the chat.

### Hierarchy

- Chat
  - MembershipChat
    - ChatChannel
    - ChatRoom

## Index

### Properties

- Events

### Methods

- addListener
- events
- getHistory
- info
- isJoined
- leave
- markSeen
- off
- on
- once
- remove
- removeAllListeners
- removeListener
- removeListeners
- send
- session
- setName
- setTopic

## Properties

### StaticEvents

Events: ChatEvents = Events

Inherited from MembershipChat.Events

## Methods

### addListener

- addListener(event: string, listener: ConvergenceEventListener<IChatEvent>): ConvergenceEventEmitter<IChatEvent>

- Inherited from ConvergenceEventEmitter.addListener

  Adds a new event listener for the specified event. The class will ignore duplicate registrations of the same listener to the same event.

  #### Parameters

  - ##### event: string

    The name of the event to add the listener for.

  - ##### listener: ConvergenceEventListener<IChatEvent>

    The listener callback to register.

  #### Returns ConvergenceEventEmitter<IChatEvent>

  This object, in support of a fluent API.

### events

- events(): Observable<IChatEvent>

- Inherited from ConvergenceEventEmitter.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

- getHistory(options?: ChatHistorySearchOptions): Promise<ChatHistoryEntry[]>

- Inherited from MembershipChat.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

  - ##### Optional options: ChatHistorySearchOptions

    Options that define the events the user would like to fetch.

  #### Returns Promise<ChatHistoryEntry[]>

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

### info

- info(): MembershipChatInfo

- Overrides Chat.info

  #### Returns MembershipChatInfo

### isJoined

- isJoined(): boolean

- Inherited from MembershipChat.isJoined

  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>

- Inherited from MembershipChat.markSeen

  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

- off(event: string, listener: ConvergenceEventListener<IChatEvent>): ConvergenceEventEmitter<IChatEvent>

- Inherited from ConvergenceEventEmitter.off

  Removes a single event listener for a specific event.

  #### Parameters

  - ##### event: string

    The name of the event to remove the listener for.

  - ##### listener: ConvergenceEventListener<IChatEvent>

    The listener callback to unregister.

  #### Returns ConvergenceEventEmitter<IChatEvent>

  This object, in support of a fluent API.

### on

- on(event: string, listener: ConvergenceEventListener<IChatEvent>): ConvergenceEventEmitter<IChatEvent>

- Inherited from ConvergenceEventEmitter.on

  Adds a new event listener for the specified event. The class will ignore duplicate registrations of the same listener to the same event.

  #### Parameters

  - ##### event: string

    The name of the event to add the listener for.

  - ##### listener: ConvergenceEventListener<IChatEvent>

    The listener callback to register.

  #### Returns ConvergenceEventEmitter<IChatEvent>

  This object, in support of a fluent API.

### once

- once(event: string, listener: ConvergenceEventListener<IChatEvent>): ConvergenceEventEmitter<IChatEvent>

- Inherited from ConvergenceEventEmitter.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

  - ##### event: string

    The name of the event to add the listener for.

  - ##### listener: ConvergenceEventListener<IChatEvent>

    The listener callback to register.

  #### Returns ConvergenceEventEmitter<IChatEvent>

  This object, in support of a fluent API.

### remove

- remove(user: DomainUserIdentifier): Promise<void>

- Removes the specified user from the Chat.

  #### Parameters

  - ##### user: DomainUserIdentifier

    The user to remove from the Chat.

  #### Returns Promise<void>

  A promise that is resolved when the specified user is successfully removed from the chat.

### removeAllListeners

- removeAllListeners(): ConvergenceEventEmitter<IChatEvent>

- Inherited from ConvergenceEventEmitter.removeAllListeners

  Removes all listeners for all events. This is useful for cleanup before disposing of this particular event emitter.

  #### Returns ConvergenceEventEmitter<IChatEvent>

  This object, in support of a fluent API.

### removeListener

- removeListener(event: string, listener: ConvergenceEventListener<IChatEvent>): ConvergenceEventEmitter<IChatEvent>

- Inherited from ConvergenceEventEmitter.removeListener

  Removes a single event listener for a specific event.

  #### Parameters

  - ##### event: string

    The name of the event to remove the listener for.

  - ##### listener: ConvergenceEventListener<IChatEvent>

    The listener callback to unregister.

  #### Returns ConvergenceEventEmitter<IChatEvent>

  This object, in support of a fluent API.

### removeListeners

- removeListeners(event: string): ConvergenceEventEmitter<IChatEvent>

- Inherited from ConvergenceEventEmitter.removeListeners

  Removes all listeners bound on the given event.

  #### Parameters

  - ##### event: string

    the name of the event to remove listeners for

  #### Returns ConvergenceEventEmitter<IChatEvent>

  This object, in support of a fluent API.

### send

- send(message: string): Promise<void>

- Inherited from MembershipChat.send

  Publishes a chat message to this Chat.

  #### Parameters

  - ##### message: string

    The message to send.

  #### Returns Promise<void>

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

### session

- session(): ConvergenceSession

- Inherited from MembershipChat.session

  #### Returns ConvergenceSession

  The ConvergenceSession this Chat is associated with.

### setName

- setName(name: string): Promise<void>

- Inherited from MembershipChat.setName

  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>

- Inherited from MembershipChat.setTopic

  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.