Interface RtmChannelEvents

Event types of the RtmChannel instance. In this interface, the function property’s name is the event name; the function property’s parameters is the parameters of the event listener function.

Example

Listening to channel messages.

channel.on('ChannelMessage', function (message, memberId) {
// Your code.
});

Example

Listening to events, such as a user joining the channel.

channel.on('MemberJoined', memberId => {
// Your code.
})

Example

Listening to events, such as a member leaving the channel

channel.on('MemberLeft', memberId => {
// Your code.
});

Hierarchy

  • RtmChannelEvents

Events

AttributesUpdated: ((attributes: ChannelAttributes) => void)

Type declaration

    • (attributes: ChannelAttributes): void
    • Occurs when channel attributes are updated, and returns all attributes of the channel.

      Note

      This callback is enabled only when the user, who updates the attributes of the channel, sets enableNotificationToChannelMembers as true. Also note that this flag is valid only within the current channel attribute method call.

      Parameters

      Returns void

ChannelMessage: ((message: RtmMessage, memberId: string, messagePros: ReceivedMessageProperties) => void)

Type declaration

MemberCountUpdated: ((memberCount: number) => void)

Type declaration

    • (memberCount: number): void
    • Occurs when the number of the channel members changes, and returns the new number.

      Note

    • When the number of channel members ≤ 512, the SDK returns this callback when the number changes at a frequency of once per second.
    • When the number of channel members exceeds 512, the SDK returns this callback when the number changes at a frequency of once every three seconds.
    • You will receive this callback when successfully joining an RTM channel, so we recommend implementing this callback to receive timely updates on the number of the channel members.

Parameters

  • memberCount: number

    Member count of this channel.

Returns void

MemberJoined: ((memberId: string) => void)

Type declaration

    • (memberId: string): void
    • Occurs when a user joins a channel.

      Note

      This callback is disabled when the number of the channel members exceeds 512.

      Parameters

      • memberId: string

        The uid of the user joining the channel.

      Returns void

MemberLeft: ((memberId: string) => void)

Type declaration

    • (memberId: string): void
    • Occurs when a user leaves the channel.

      This callback is triggered when the user calls leave to leave a channel or the user stays disconnected with the Agora RTM system for 30 seconds due to network issues.

      Note

      This callback is disabled when the number of the channel members exceeds 512.

      Parameters

      • memberId: string

        The uid of the user leaving the channel.

      Returns void

Generated using TypeDoc