Signaling (previously RTM) v1.4.8 API Reference for Unity
|
The Agora RTM SDK provides a stable messaging mechanism for you to implement real-time messaging scenarios.
This page lists the core APIs of the Agora RTM SDK. Unless otherwise specified, most of the core APIs should only be called after the Login method call succeeds and after you receive the OnLoginSuccessHandler callback.
Following are the core functionalities that the Agora RTM SDK provides.
You need to understand the connection state between the SDK and the Agora RTM system before developing an RTM app. For more information, see Manage Connection States.
Method | Description |
---|---|
RtmClient | Creates and returns RtmClient instance. |
Login | Logs in the Agora RTM system. |
Logout | Logs out of the Agora RTM system. |
Dispose | Releases all resources that the RtmClient instance uses. |
Event | Description |
---|---|
OnLoginSuccessHandler | Occurs when a user logs in the Agora RTM system. |
OnLoginFailureHandler | Occurs when a user fails to log in the Agora RTM system. |
OnLogoutHandler | Occurs when a user logs out of the Agora RTM system. |
OnConnectionStateChangedHandler | Occurs when the connection state between the SDK and the Agora RTM system changes. |
Method | Description |
---|---|
CreateMessage | Creates and returns an empty text TextMessage instance. |
CreateMessage | Creates and returns a text TextMessage instance. |
CreateMessage | Creates and returns a raw TextMessage instance. |
CreateMessage | Creates and returns a raw TextMessage instance and sets its description. |
SendMessageToPeer | Sends a peer-to-peer message to a specified user (receiver). When used with a prefix, this method is similar to the endCall method of the Agora Signaling SDK. |
Dispose | Releases all resources that the TextMessage uses. |
Event | Description |
---|---|
OnSendMessageResultHandler | Returns the result of the SendMessageToPeer(string peerId, IMessage message, SendMessageOptions options) or SendMessageToPeer(string peerId, IMessage message) method call. |
OnMessageReceivedFromPeerHandler | Occurs when receiving a peer-to-peer message. |
Method | Description |
---|---|
QueryPeersOnlineStatus | Queries the online status of the specified users. |
Event | Description |
---|---|
OnQueryPeersOnlineStatusResultHandler | Returns the result of the QueryPeersOnlineStatus method call. |
Method | Description |
---|---|
SubscribePeersOnlineStatus | Subscribes to the online status of the specified users. |
UnsubscribePeersOnlineStatus | Unsubscribes from the online status of the specified users. |
QueryPeersBySubscriptionOption | Gets a list of the peers, to whose specific status you have subscribed. |
Event | Description |
---|---|
OnSubscriptionRequestResultHandler | Reports the result of the SubscribePeersOnlineStatus or the UnsubscribePeersOnlineStatus method call. |
OnPeersOnlineStatusChangedHandler | Occurs when the online status of the peers, to whom you subscribe, changes. See PeerOnlineStatus for the online status of a peer. |
OnQueryPeersBySubscriptionOptionResultHandler | Returns the result of the QueryPeersBySubscriptionOption method call. |
Method | Description |
---|---|
CreateChannelAttribute | Creates and returns an RtmChannelAttribute instance. |
DeleteLocalUserAttributesByKeys | Deletes the local user's attributes by attribute keys. |
ClearLocalUserAttributes | Clears all attributes of the local user. |
GetUserAttributes | Gets all attributes of a specified user. |
GetUserAttributesByKeys | Gets the attributes of a specified user by attribute keys. |
Event | Description |
---|---|
OnDeleteLocalUserAttributesResultHandler | Reports the result of the DeleteLocalUserAttributesByKeys method call. |
OnClearLocalUserAttributesResultHandler | Reports the result of the ClearLocalUserAttributes method call. |
OnGetUserAttributesResultHandler | Reports the result of the GetUserAttributes or GetUserAttributesByKeys method call. |
Method | Description |
---|---|
SetChannelAttributes | Sets the attributes of a specified channel with new ones. |
DeleteChannelAttributesByKeys | Deletes the attributes of a specified channel by attribute keys. |
ClearChannelAttributes | Clears all attributes of a specified channel. |
GetChannelAttributes | Gets all attributes of a specified channel. |
GetChannelAttributesByKeys | Gets the attributes of a specified channel by attribute keys. |
Event | Description |
---|---|
OnSetChannelAttributesResultHandler | Reports the result of the SetChannelAttributes method call. |
OnDeleteChannelAttributesResultHandler | Reports the result of the DeleteChannelAttributesByKeys method call. |
OnClearChannelAttributesResultHandler | Reports the result of the ClearChannelAttributes method call. |
OnGetChannelAttributesResultHandler | Reports the result of the GetChannelAttributes or GetChannelAttributesByKeys method call. |
Event for all channel members | Description |
---|---|
OnAttributesUpdatedHandler | Reports all attributes of the channel when the channel attributes are updated. |
Method | Description |
---|---|
GetChannelMemberCount | Gets the member count of specified channels. You do not have to join the specified channels to call this method. |
Event | Description |
---|---|
OnGetChannelMemberCountResultHandler | Reports the result of the GetChannelMemberCount method call. |
Event | Description |
---|---|
OnMediaUploadingProgressHandler | Reports the progress of an ongoing uploading task. |
OnMediaCancelResultHandler | Reports the result of the CancelMediaDownload or CancelMediaUpload method call. |
OnFileMediaUploadResultHandler | Reports the result of the CreateFileMessageByUploading method call. |
OnMediaDownloadingProgressHandler | Reports the progress of an ongoing downloading task. |
OnMediaCancelResultHandler | Reports the result of the CancelMediaDownload or the CancelMediaUpload method call. |
OnMediaDownloadToMemoryResultHandler | Reports the result of the DownloadMediaToMemory method call. |
OnMediaDownloadToFileResultHandler | Reports the result of the DownloadMediaToFile method call. |
Method | Description |
---|---|
CreateChannel | Creates an RtmChannel object. |
Join | Joins a channel. |
Leave | Leaves a channel. |
Dispose | Releases all resources used by the RtmChannel object. |
Event | Description |
---|---|
OnJoinSuccessHandler | Occurs when a user joins a channel. |
OnJoinFailureHandler | Occurs when a user fails to join a channel. |
OnLeaveHandler | Reports the result of the Leave method call. |
OnMemberJoinedHandler | Occurs when a user joins a channel. |
OnMemberLeftHandler | Occurs when a channel member leaves a channel. |
OnMemberCountUpdatedHandler | Occurs when the number of the channel members changes. This callback returns the new number. |
Method | Description |
---|---|
CreateMessage | Creates and returns an empty text TextMessage instance. |
CreateMessage | Creates and returns an text IMessage instance. |
CreateMessage | Creates and returns an raw IMessage instance. |
CreateMessage | Creates and returns an IMessage instance. |
sendMessage | Allows a channel member to send a message to all members the channel. |
Release | Releases all resources that the IMessage uses. |
Event | Description |
---|---|
OnSendMessageResultHandler | Reports the result of the SendMessage method call. |
OnMessageReceivedHandler | Occurs when all remote users receive a channel message from a sender. |
Method | Description |
---|---|
GetMembers | Retrieves the member list of a channel. |
Event | Description |
---|---|
OnGetMembersHandler | Reports the result of the GetMembers method call. For the data structure of the channel member, see ChannelMemberCount . |
Method for Managing a Call Manager | Description |
---|---|
GetRtmCallManager | Gets an RTM call manager. |
Dispose | Releases all resources used by the RtmCallManager instance. |
Caller Method | Description |
---|---|
CreateLocalCallInvitation | Allows the caller to create and manage an LocalInvitation object. |
SendLocalInvitation | Allows the caller to send a call invitation to a remote user. |
CancelLocalInvitation | Allows the caller to cancel a call invitation. |
Dispose | Releases all resources used by the LocalInvitation instance. |
Callee Method | Description |
---|---|
AcceptRemoteInvitation | Allows the callee to accept a call invitation. |
RefuseRemoteInvitation | Allows the callee to decline a call invitation. |
Dispose | Releases all resources used by the RemoteInvitation instance. |
Caller Event | Description |
---|---|
OnLocalInvitationReceivedByPeerHandler | Callback to the caller: occurs when the callee receives the call invitation. |
OnLocalInvitationCanceledHandler | Callback to the caller: occurs when the caller cancels a sent call invitation. |
OnLocalInvitationAcceptedHandler | Callback to the caller: occurs when the callee accepts the call invitation. |
OnLocalInvitationRefusedHandler | Callback to the caller: occurs when the callee refuses the call invitation. |
OnLocalInvitationFailureHandler | Callback to the caller: occurs when the life cycle of an outgoing call invitation ends in failure. |
Callee Event | Description |
---|---|
OnRemoteInvitationReceivedHandler | Callback to the callee: occurs when the callee receives a call invitation. At the same time, the SDK returns an RemoteInvitation object to the callee. |
OnRemoteInvitationAcceptedHandler | Callback to the callee: occurs when the callee accepts a call invitation. |
OnRemoteInvitationRefusedHandler | Callback to the callee: occurs when the callee declines a call invitation. |
OnRemoteInvitationCanceledHandler | Callback to the callee: occurs when the caller cancels the call invitation. |
OnRemoteInvitationFailureHandler | Callback to the callee: occurs when the life cycle of the incoming call invitation ends in failure. |
Method | Description |
---|---|
RenewToken | Renews the RTM Token of the SDK. |
Event | Description |
---|---|
OnTokenExpiredHandler | Occurs when the RTM server detects that the RTM token has passed the 24-hour validity period and when the SDK is in the CONNECTION_STATE_RECONNECTING state. |
OnRenewTokenResultHandler | Reports the result of the RenewToken method call. |
- You can perform log file related operations after creating the RtmClient instance and before calling the Login method.
GetSdkVersion
is a global method. You can call it before creating an RtmClient instance.
Method | Description |
---|---|
SetLogFile | Specifies the default path to the SDK log file. |
SetLogFilter | Sets the output log level of the SDK. |
SetLogFileSize | Sets the size of a single log file. The SDK has two log files with the same size. |
GetSdkVersion | Gets the version of the Agora RTM SDK. |
Method | Description |
---|---|
SetParameters | Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options. |