Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Events

AttributesUpdated

AttributesUpdated: function

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.

Type declaration

ChannelMessage

ChannelMessage: function

Occurs when the local user receives a channel message.

param

The received channel message object.

param

The uid of the sender.

Type declaration

MemberCountUpdated

MemberCountUpdated: function

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.
  • param

    Member count of this channel.

    Type declaration

      • (memberCount: number): void
      • Parameters

        • memberCount: number

        Returns void

    MemberJoined

    MemberJoined: function

    Occurs when a user joins a channel.

    Note

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

    The uid of the user joining the channel.

    Type declaration

      • (memberId: string): void
      • Parameters

        • memberId: string

        Returns void

    MemberLeft

    MemberLeft: function

    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.
    param

    The uid of the user leaving the channel.

    Type declaration

      • (memberId: string): void
      • Parameters

        • memberId: string

        Returns void