Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface RtmClientEvents

Event listener type of the RtmClient 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 peer-to-peer messages.

client.on('MessageFromPeer', function (message, peerId) {
  // Your code.
});

Hierarchy

  • RtmClientEvents

Index

Events

ConnectionStateChanged

ConnectionStateChanged: function

Occurs when the connection state changes between the SDK and the Agora RTM system.

param

The new connection state.

param

Reasons for the connection state change.

Type declaration

MessageFromPeer

MessageFromPeer: function

Occurs when the local user receives a peer-to-peer message from a remote user.

param

The received peer-to-peer message object.

param

The uid of the sender.

param

The properties of the received message.

Type declaration

RemoteInvitationReceived

RemoteInvitationReceived: function

Occurs when the callee receives a call invitation from a remote user (caller).

param

A RemoteInvitation object.

Type declaration

Properties

FallbackProxyConnected

FallbackProxyConnected: function

Occurs when the SDK automatically switches to proxy WebSocket of 443 port.

Type declaration

    • (): void
    • Returns void

PeersOnlineStatusChanged

PeersOnlineStatusChanged: function

Occurs when the online status of the peers, to whom you subscribe, changes.

  • When the subscription to the online status of specified peer(s) succeeds, the SDK returns this callback to report the online status of peers, to whom you subscribe.
  • When the online status of the peers, to whom you subscribe, changes, the SDK returns this callback to report whose online status has changed.
  • If the online status of the peers, to whom you subscribe, changes when the SDK is reconnecting to the server, the SDK returns this callback to report whose online status has changed when successfully reconnecting to the server.

Type declaration

TokenExpired

TokenExpired: function

Occurs when the RTM server detects that the RTM token has exceeded the specified validity period.

  • If the SDK is in the CONNECTED state, the connection state switches to ABORTED and you need to call the login method to log in again.
  • If the SDK is in the RECONNECTING state, you will receive this callback when the network reconnects and you need to call renewToken to pass the new token on to the server.

Type declaration

    • (): void
    • Returns void

TokenPrivilegeWillExpire

TokenPrivilegeWillExpire: function

Occurs when the token expires in 30 seconds.

  • Upon receiving this callback, generate a new RTM Token on the server and call the renewToken method to pass the new Token on to the SDK.
  • If the token used in a login session expires, the user becomes offline and the SDK attempts to reconnect.

Type declaration

    • (): void
    • Returns void