Public Member Functions

void onConnectionStateChanged (int state, int reason)
 
void onMessageReceived (RtmMessage message, String peerId)
 
void onTokenExpired ()
 
void onPeersOnlineStatusChanged (Map< String, Integer > peersStatus)
 

Detailed Description

Callbacks for the Agora RTM client methods.

Member Function Documentation

◆ onConnectionStateChanged()

void io.agora.rtm.RtmClientListener.onConnectionStateChanged ( int  state,
int  reason 
)

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

Parameters
stateThe new connection state. See ConnectionState.
reasonThe reason for the connection state change. See ConnectionChangeReason.

◆ onMessageReceived()

void io.agora.rtm.RtmClientListener.onMessageReceived ( RtmMessage  message,
String  peerId 
)

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

Parameters
messageThe received message. See RtmMessage.
peerIdThe user ID of the message sender.

◆ onTokenExpired()

void io.agora.rtm.RtmClientListener.onTokenExpired ( )

Occurs when the current RTM Token exceeds the 24-hour validity period.

This callback occurs when the current RTM Token exceeds the 24-hour validity period and reminds the user to renew it. When receiving this callback, generate a new RTM Token on the server and call the renewToken method to pass the new Token on to the server.

◆ onPeersOnlineStatusChanged()

void io.agora.rtm.RtmClientListener.onPeersOnlineStatusChanged ( Map< String, Integer >  peersStatus)

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.
Parameters
peersStatusAn array of peers' online states. See PeerOnlineState.