Options
All
  • Public
  • Public/Protected
  • All
Menu

Class to represent an RTM channel. You can call the createChannel method to create an RtmClient instance.

noinheritdoc

Hierarchy

Index

Constructors

constructor

  • Returns RtmChannel

Properties

Readonly channelId

channelId: string
readonly

ID of the RTM channel instance.

Static defaultMaxListeners

defaultMaxListeners: number

Methods

getMembers

  • getMembers(): Promise<string[]>
  • Gets the member list of the channel.

    Returns Promise<string[]>

    The Promise resolves after the user gets the member list of the channel in an array with the channel's uids.

join

  • join(): Promise<void>
  • Joins a channel. After joining the channel, the user can receive channel messages and notifications of other users joining or leaving the channel.

    You can join a maximum of 20 channels.

    Returns Promise<void>

    The Promise resolves after the user successfully joins the channel.

leave

  • leave(): Promise<void>
  • Leaves a channel. After leaving the channel, the user does not receive channel messages or notifications of users joining or leaving the channel.

    Returns Promise<void>

    The Promise resolves after the user successfully leaves the channel.

listenerCount

  • listenerCount<P, T>(event: P): number
  • Type parameters

    Parameters

    • event: P

    Returns number

listeners

  • listeners<P, T>(event: P): Function[]
  • Type parameters

    Parameters

    • event: P

    Returns Function[]

off

  • off<P, T>(event: P, listener: (...args: any[]) => any): RtmChannel
  • Type parameters

    Parameters

    • event: P
    • listener: (...args: any[]) => any
        • (...args: any[]): any
        • Parameters

          • Rest ...args: any[]

          Returns any

    Returns RtmChannel

on

  • Adds the listener function to the channel for the event named eventName. See the EventEmitter API documentation for other event methods on the RtmChannel instance.

    Type parameters

    Parameters

    • eventName: EventName

      The name of the channel event. See the property names in the RtmChannelEvents for the list of events.

    • listener: (...args: ListenerType<RtmChannelEvents[EventName]>) => any

      The callback function of the channel event.

    Returns RtmChannel

once

rawListeners

  • rawListeners<P, T>(event: P): Function[]
  • Type parameters

    Parameters

    • event: P

    Returns Function[]

removeAllListeners

  • Type parameters

    Parameters

    • Optional event: P

    Returns RtmChannel

sendMessage

  • Allows a user to send a message to all users in a channel.

    You can send messages, including peer-to-peer and channel messages at a maximum frequency of 180 calls every three seconds.

    example

    Sending a channel message.

    channel.sendMessage({ text: 'test channel message' }).then(() => {
    // Your code for handling the event when the channel message is successfully sent.
    }).catch(error => {
    // Your code for handling the event when the channel message fails to be sent.
    });
    note

    In development, you can set the sent channel message as the sent message in the UI of your application. Thus, you can display the message status in the UI. The user who sends the channel message does not receive the same channel message.

    Parameters

    Returns Promise<void>

    The Promise resolves after the user successfully sends a channel message.

Generated using TypeDoc