Server Gateway SDK v3.7.200.21 for Linux Java
Public Member Functions | List of all members
io.agora.rtc.IRtcConnObserver Interface Reference

Public Member Functions

void onConnected (AgoraRtcConn agora_rtc_conn, RtcConnInfo conn_info, int reason)
 
void onDisconnected (AgoraRtcConn agora_rtc_conn, RtcConnInfo conn_info, int reason)
 
void onConnecting (AgoraRtcConn agora_rtc_conn, RtcConnInfo conn_info, int reason)
 
void onReconnecting (AgoraRtcConn agora_rtc_conn, RtcConnInfo conn_info, int reason)
 
void onConnectionLost (AgoraRtcConn agora_rtc_conn, RtcConnInfo conn_info)
 
void onLastmileQuality (AgoraRtcConn agora_rtc_conn, int quality)
 
void onLastmileProbeResult (AgoraRtcConn agora_rtc_conn, LastmileProbeResult result)
 
void onTokenPrivilegeWillExpire (AgoraRtcConn agora_rtc_conn, String token)
 
void onTokenPrivilegeDidExpire (AgoraRtcConn agora_rtc_conn)
 
void onConnectionFailure (AgoraRtcConn agora_rtc_conn, RtcConnInfo conn_info, int reason)
 
void onUserJoined (AgoraRtcConn agora_rtc_conn, String user_id)
 
void onUserLeft (AgoraRtcConn agora_rtc_conn, String user_id, int reason)
 
void onTransportStats (AgoraRtcConn agora_rtc_conn, RtcStats stats)
 
void onChangeRoleSuccess (AgoraRtcConn agora_rtc_conn, int old_role, int new_role)
 
void onChangeRoleFailure (AgoraRtcConn agora_rtc_conn)
 
void onUserNetworkQuality (AgoraRtcConn agora_rtc_conn, String user_id, int tx_quality, int rx_quality)
 
void onNetworkTypeChanged (AgoraRtcConn agora_rtc_conn, int type)
 
void onEncryptionError (AgoraRtcConn agora_rtc_conn, int error_type)
 
void onUploadLogResult (AgoraRtcConn agora_rtc_conn, String request_id, int success, int reason)
 

Detailed Description

The IRtcConnObserver interface.

Member Function Documentation

◆ onChangeRoleFailure()

void io.agora.rtc.IRtcConnObserver.onChangeRoleFailure ( AgoraRtcConn  agora_rtc_conn)

Occurs when the local user fails to change the user role.

Parameters
agora_rtc_connAn AgoraRtcConn object.

◆ onChangeRoleSuccess()

void io.agora.rtc.IRtcConnObserver.onChangeRoleSuccess ( AgoraRtcConn  agora_rtc_conn,
int  old_role,
int  new_role 
)

Occurs when the role of the local user changes.

Parameters
agora_rtc_connAn AgoraRtcConn object.
old_roleThe previous role of the local user.
  • 1: Broadcaster. A broadcaster can both send and receive streams.
  • 2: Audience. An audience can only receive streams.
new_roleThe current role of the local user.
  • 1: Broadcaster. A broadcaster can both send and receive streams.
  • 2: Audience. An audience can only receive streams.

◆ onConnected()

void io.agora.rtc.IRtcConnObserver.onConnected ( AgoraRtcConn  agora_rtc_conn,
RtcConnInfo  conn_info,
int  reason 
)

Occurs when the connection state between the SDK and the Agora channel changes to CONNECTION_STATE_CONNECTED(3).

Parameters
agora_rtc_connAn AgoraRtcConn object.
conn_infoThe information of the connection.
reasonThe reason of the connection state change.
  • 0: The SDK is connecting to the server.
  • 1: The SDK has joined the channel successfully.
  • 2: The connection between the SDK and the server is interrupted.
  • 3: The connection between the SDK and the server is banned by the server.
  • 4: The SDK fails to join the channel for more than 20 minutes and stops reconnecting to the channel.
  • 5: The SDK has left the channel.
  • 6: The connection fails because the App ID is not valid.
  • 7: The connection fails because the channel name is not valid.
  • 8: The connection fails because the token is not valid.
  • 9: The connection fails because the token has expired.
  • 10: The connection is rejected by the server.
  • 11: The connection changes to reconnecting because the SDK has set a proxy server.
  • 12: When the connection state changes because the app has renewed the token.
  • 13: The IP Address of the app has changed. A change in the network type or IP/Port changes the IP address of the app.
  • 14: A timeout occurs for the keep-alive of the connection between the SDK and the server.
  • 15: The SDK has rejoined the channel successfully.
  • 16: The connection between the SDK and the server is lost.
  • 17: The change of connection state is caused by echo test.
  • 18: The local IP Address is changed.

◆ onConnecting()

void io.agora.rtc.IRtcConnObserver.onConnecting ( AgoraRtcConn  agora_rtc_conn,
RtcConnInfo  conn_info,
int  reason 
)

Occurs when the connection state between the SDK and the Agora channel changes to 2 (connecting).

Parameters
agora_rtc_connAn AgoraRtcConn object.
conn_infoThe information of the connection.
reasonThe reason of the connection state change.

◆ onConnectionFailure()

void io.agora.rtc.IRtcConnObserver.onConnectionFailure ( AgoraRtcConn  agora_rtc_conn,
RtcConnInfo  conn_info,
int  reason 
)

Occurs when the connection state between the SDK and the Agora channel changes to 5 (failed).

Parameters
agora_rtc_connAn AgoraRtcConn object.
conn_infoThe connection information.
reasonThe reason of the connection state change.

◆ onConnectionLost()

void io.agora.rtc.IRtcConnObserver.onConnectionLost ( AgoraRtcConn  agora_rtc_conn,
RtcConnInfo  conn_info 
)

Occurs when the SDK loses connection with the Agora channel.

Parameters
agora_rtc_connAn AgoraRtcConn object.
conn_infoThe information of the connection.

◆ onDisconnected()

void io.agora.rtc.IRtcConnObserver.onDisconnected ( AgoraRtcConn  agora_rtc_conn,
RtcConnInfo  conn_info,
int  reason 
)

Occurs when the connection state between the SDK and the Agora channel changes to 1 (disconnected).

Parameters
agora_rtc_connAn AgoraRtcConn object.
conn_infoThe information of the connection.
reasonThe reason of the connection state change.

◆ onEncryptionError()

void io.agora.rtc.IRtcConnObserver.onEncryptionError ( AgoraRtcConn  agora_rtc_conn,
int  error_type 
)

Occurs when an error occurs during encryption.

Parameters
agora_rtc_connAn AgoraRtcConn object.
error_typeType of the error.

◆ onLastmileProbeResult()

void io.agora.rtc.IRtcConnObserver.onLastmileProbeResult ( AgoraRtcConn  agora_rtc_conn,
LastmileProbeResult  result 
)

Reports the result of the last-mile network probe test.

The SDK triggers this callback within 30 seconds after the app calls startLastmileProbeTest.

Parameters
agora_rtc_connAn AgoraRtcConn object.
resultThe result of the last-mile network probe test: LastmileProbeResult.

◆ onLastmileQuality()

void io.agora.rtc.IRtcConnObserver.onLastmileQuality ( AgoraRtcConn  agora_rtc_conn,
int  quality 
)

Reports the quality of the last-mile network.

The SDK triggers this callback within two seconds after the app calls startLastmileProbeTest.

Parameters
agora_rtc_connAn AgoraRtcConn object.
qualityQuality of the last-mile network.
  • 0: The network quality is unknown.
  • 1: The quality is excellent.
  • 2: The quality is quite good, but the bitrate may be slightly lower than excellent.
  • 3: Users can feel the communication slightly impaired.
  • 4: Users cannot communicate smoothly.
  • 5: Users can barely communicate.
  • 6: Users cannot communicate at all.

◆ onNetworkTypeChanged()

void io.agora.rtc.IRtcConnObserver.onNetworkTypeChanged ( AgoraRtcConn  agora_rtc_conn,
int  type 
)

Occurs when the network type is changed.

Parameters
agora_rtc_connAn AgoraRtcConn object.
typeThe current network type.
  • -1: The network type is unknown.
  • 0: The network type is disconnected.
  • 1: The network type is LAN.
  • 2: The network type is Wi-Fi.
  • 3: The network type is mobile 2G.
  • 4: The network type is mobile 3G.
  • 5: The network type is mobile 4G.

◆ onReconnecting()

void io.agora.rtc.IRtcConnObserver.onReconnecting ( AgoraRtcConn  agora_rtc_conn,
RtcConnInfo  conn_info,
int  reason 
)

Occurs when the connection state between the SDK and the Agora channel changes to 4 (reconnecting).

Parameters
agora_rtc_connAn AgoraRtcConn object.
conn_infoThe information of the connection.
reasonThe reason of the connection state change.

◆ onTokenPrivilegeDidExpire()

void io.agora.rtc.IRtcConnObserver.onTokenPrivilegeDidExpire ( AgoraRtcConn  agora_rtc_conn)

Occurs when the token has expired.

Parameters
agora_rtc_connAn AgoraRtcConn object. Upon receiving this callback, you must generate a new token on your server and connect to the RTC channel with the new token.

◆ onTokenPrivilegeWillExpire()

void io.agora.rtc.IRtcConnObserver.onTokenPrivilegeWillExpire ( AgoraRtcConn  agora_rtc_conn,
String  token 
)

Occurs when the token expires in 30 seconds.

The SDK triggers this callback to remind the app to get a new token before the token privilege expires.

Upon receiving this callback, you must generate a new token on your server and call renewToken to pass the new token to the SDK.

Parameters
agora_rtc_connAn AgoraRtcConn object.
tokenThe pointer to the token that expires in 30 seconds.

◆ onTransportStats()

void io.agora.rtc.IRtcConnObserver.onTransportStats ( AgoraRtcConn  agora_rtc_conn,
RtcStats  stats 
)

Reports the transport statistics of the connection.

The SDK triggers this callback once every two seconds when the connection state is 3 (connected).

Parameters
agora_rtc_connAn AgoraRtcConn object.
statsThe transport status.

◆ onUploadLogResult()

void io.agora.rtc.IRtcConnObserver.onUploadLogResult ( AgoraRtcConn  agora_rtc_conn,
String  request_id,
int  success,
int  reason 
)

◆ onUserJoined()

void io.agora.rtc.IRtcConnObserver.onUserJoined ( AgoraRtcConn  agora_rtc_conn,
String  user_id 
)

Occurs when a remote user joins the channel.

You can get the ID of the remote user in this callback.

Parameters
agora_rtc_connAn AgoraRtcConn object.
user_idThe ID of the remote user who joins the channel.

◆ onUserLeft()

void io.agora.rtc.IRtcConnObserver.onUserLeft ( AgoraRtcConn  agora_rtc_conn,
String  user_id,
int  reason 
)

Occurs when a remote user leaves the channel.

You can know why the user leaves the channel through the reason parameter.

Parameters
agora_rtc_connAn AgoraRtcConn object.
user_idThe ID of the user who leaves the channel.
reasonThe reason of the connection state change.

◆ onUserNetworkQuality()

void io.agora.rtc.IRtcConnObserver.onUserNetworkQuality ( AgoraRtcConn  agora_rtc_conn,
String  user_id,
int  tx_quality,
int  rx_quality 
)

Reports the network quality of each user.

The SDK triggers this callback once every two seconds to report the uplink and downlink network conditions of each user in the channel, including the local user.

Parameters
agora_rtc_connAn AgoraRtcConn object.
user_idThe ID of the user. If user_id is empty, this callback reports the network quality of the local user.
tx_qualityThe uplink network quality.
rx_qualityThe downlink network quality.

The documentation for this interface was generated from the following file: