Signaling (previously RTM) SDK v1.5.0 API Reference for Linux (Java)
|
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 theonSuccess
callback.
Connection states between the SDK and the Agora RTM system is a core concept for you to understand before developing an RTM app. For more information, see Manage Connection States.
Method | Description |
---|---|
createInstance
|
Creates and returns an
RtmClient
instance.
|
login
|
Logs in the Agora RTM system. |
logout
|
Logs out of the Agora RTM system. |
release
|
Releases all resources used by the
RtmClient
instance.
|
Event | Description |
---|---|
onConnectionStateChanged
|
Occurs when the connection state changes between the SDK and the Agora RTM system. |
Method | Description |
---|---|
createMessage
|
Creates and returns an empty text
RtmMessage
instance.
|
createMessage
|
Creates and returns a text
RtmMessage
instance.
|
createMessage
|
Creates and returns a raw
RtmMessage
instance.
|
createMessage
|
Creates and returns a raw
RtmMessage
instance with a brief text description.
|
sendMessageToPeer
|
Sends a peer-to-peer message to a specified user. When used with a prefix, it serves
a similar function to the endCall method of the Agora Signaling SDK. See
SendMessageOptions
for the offline messaging settings.
|
Event | Description |
---|---|
RtmClientListener.onMessageReceived
|
Occurs when receiving a peer-to-peer message. |
Method | Description |
---|---|
queryPeersOnlineStatus
|
Queries the online status of the specified users. |
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. See
PeerSubscriptionOption
for the status type, to which you have subscribed.
|
Event | Description |
---|---|
onPeersOnlineStatusChanged
|
Occurs when the online status of the peers, to whom you subscribe, changes. |
Method | Description |
---|---|
setLocalUserAttributes
|
Substitutes the local user's attributes with new ones. |
addOrUpdateLocalUserAttributes
|
Adds or updates the local user's attributes. |
deleteLocalUserAttributesByKeys
|
Deletes the local user's attributes using 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 using attribute keys. |
Method | Description |
---|---|
setChannelAttributes
|
Sets the attributes of a specified channel with new ones. |
addOrUpdateChannelAttributes
|
Adds or updates the attributes of a specified channel. |
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 for all channel members | Description |
---|---|
onAttributesUpdated
|
Returns all attributes of the channel when the channel attributes are updated. See
setEnableNotificationToChannelMembers
for how to enable it.
|
Method | Description |
---|---|
getChannelMemberCount
|
Gets the member count of specified channels. You do not have to join the specified channels to call this method. |
Method | Description |
---|---|
createChannel
|
Creates an
RtmChannel
instance.
|
join
|
Joins a channel. |
leave
|
Leaves a channel. |
getId
|
Retrieves the channel ID. |
release
|
Releases all resources used by the current channel. |
Event | Description |
---|---|
onMemberJoined
|
Occurs when a remote user joins the channel. |
onMemberLeft
|
Occurs when a remote channel member leaves the channel. |
onMemberCountUpdated
|
Occurs when the number of the channel members changes, and returns the new number. |
Method | Description |
---|---|
createMessage
|
Creates and returns an empty text
RtmMessage
instance.
|
createMessage
|
Creates and returns a text
RtmMessage
instance.
|
createMessage
|
Creates and returns a raw
RtmMessage
instance.
|
createMessage
|
Creates and returns a raw
RtmMessage
instance with a brief text description.
|
sendMessage
|
Allows a channel member to send a message to all members in the channel. |
Event | Description |
---|---|
RtmChannelListener.onMessageReceived
|
Occurs when receiving a channel message. |
Method | Description |
---|---|
getMembers
|
Retrieves the member list of a channel. |
Method for Managing a Call Manager | Description |
---|---|
getRtmCallManager
|
Gets an Agora RTM call manager. |
setEventListener
|
Sets the event listener of an
RtmCallManager
instance.
|
Caller Method | Description |
---|---|
createLocalInvitation
|
Allows the caller to create and manage a
LocalInvitation
object.
|
sendLocalInvitation
|
Allows the caller to send a call invitation to a remote user. |
cancelLocalInvitation
|
Allows the caller to cancel a sent call invitation. |
acceptRemoteinvitation
|
Allows the callee to accept a received call invitation.
|
refuseRemoteInvitation
|
Allows the callee to decline a received call invitation.
|
Callee Method | Description |
---|---|
createLocalInvitation
|
Allows the caller to create and manage a
LocalInvitation
object.
|
acceptRemoteinvitation
|
Allows the callee to accept a received call invitation. |
refuseRemoteInvitation
|
Allows the callee to decline a received call invitation. |
Caller Event | Description |
---|---|
onLocalInvitationReceivedByPeer
|
Callback to the caller: occurs when the callee receives the call invitation. |
onLocalInvitationCanceled
|
Callback to the caller: occurs when the caller cancels a sent call invitation. |
onLocalInvitationAccepted
|
Callback to the caller: occurs when the callee accepts the call invitation. |
onLocalInvitationRefused
|
Callback to the caller: occurs when the callee declines the call invitation. |
onLocalInvitationFailure
|
Callback to the caller: occurs when the life cycle of an outgoing call invitation
ends in failure. See
LocalInvitationError
for the error codes.
|
Callee Event | Description |
---|---|
onRemoteInvitationReceived
|
Callback to the callee: occurs when the callee receives a call invitation. At the
same time, the SDK returns a
RemoteInvitation
object to the callee.
|
onRemoteInvitationAccepted
|
Callback to the callee: occurs when the callee accepts a received call invitation. |
onRemoteInvitationRefused
|
Callback for the callee: occurs when the callee declines a received call invitation. |
onRemoteInvitationCanceled
|
Callback to the callee: occurs when the caller cancels the call invitation. |
onRemoteInvitationFailure
|
Callback to the callee: occurs when the life cycle of the incoming call invitation
ends in failure. See
RemoteInvitationError
for the error code.
|
Method | Description |
---|---|
renewToken
|
Renews the RTM Token of the SDK. |
Event | Description |
---|---|
onTokenExpired
|
Occurs when the RTM server detects that the RTM token has exceeded the specified validity period. |
- Log file-related operations can be done after creating an
RtmClient
instance and before calling thelogin
method.
getSDKVersion
is a static method. You can call it before creating anRtmClient
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 SDK version. |
Method | Description |
---|---|
setParameters
|
Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options. |
Method | Description |
---|---|
setRtmServiceContext
|
Sets the context of all RtmClient instances. All
RtmClient instances you create after calling this method match the
context.
|