Signaling (previously RTM) SDK v1.5.0 API Reference for Linux (C++)
|
#include <IAgoraRtmService.h>
Public Member Functions |
|
virtual int | initialize (const char *appId, IRtmServiceEventHandler *eventHandler)=0 |
virtual void | addEventHandler (IRtmServiceEventHandler *eventHandler)=0 |
virtual void | removeEventHandler (IRtmServiceEventHandler *eventHandler)=0 |
virtual void | release (bool sync=false)=0 |
virtual int | login (const char *token, const char *userId)=0 |
virtual int | logout ()=0 |
virtual int | renewToken (const char *token)=0 |
virtual int | sendMessageToPeer (const char *peerId, const IMessage *message)=0 |
virtual int | downloadMediaToMemory (const char *mediaId, long long &requestId)=0 |
virtual int | downloadMediaToFile (const char *mediaId, const char *filePath, long long &requestId)=0 |
virtual int | cancelMediaDownload (long long requestId)=0 |
virtual int | cancelMediaUpload (long long requestId)=0 |
virtual int | sendMessageToPeer (const char *peerId, const IMessage *message, const SendMessageOptions &options)=0 |
virtual IChannel * | createChannel (const char *channelId, IChannelEventHandler *eventHandler)=0 |
virtual IRtmCallManager * | getRtmCallManager (IRtmCallEventHandler *eventHandler)=0 |
virtual IMessage * | createMessage ()=0 |
virtual IMessage * | createMessage (const char *message)=0 |
virtual IMessage * | createMessage (const uint8_t *rawData, int length)=0 |
virtual IMessage * | createMessage (const uint8_t *rawData, int length, const char *description)=0 |
virtual IFileMessage * | createFileMessageByMediaId (const char *mediaId)=0 |
virtual IImageMessage * | createImageMessageByMediaId (const char *mediaId)=0 |
virtual int | createFileMessageByUploading (const char *filePath, long long &requestId)=0 |
virtual int | createImageMessageByUploading (const char *filePath, long long &requestId)=0 |
virtual IRtmChannelAttribute * | createChannelAttribute ()=0 |
virtual int | setParameters (const char *parameters)=0 |
virtual int | queryPeersOnlineStatus (const char *peerIds[], int peerCount, long long &requestId)=0 |
virtual int | subscribePeersOnlineStatus (const char *peerIds[], int peerCount, long long &requestId)=0 |
virtual int | unsubscribePeersOnlineStatus (const char *peerIds[], int peerCount, long long &requestId)=0 |
virtual int | queryPeersBySubscriptionOption (PEER_SUBSCRIPTION_OPTION option, long long &requestId)=0 |
virtual int | setLocalUserAttributes (const RtmAttribute *attributes, int numberOfAttributes, long long &requestId)=0 |
virtual int | addOrUpdateLocalUserAttributes (const RtmAttribute *attributes, int numberOfAttributes, long long &requestId)=0 |
virtual int | deleteLocalUserAttributesByKeys (const char *attributeKeys[], int numberOfKeys, long long &requestId)=0 |
virtual int | clearLocalUserAttributes (long long &requestId)=0 |
virtual int | getUserAttributes (const char *userId, long long &requestId)=0 |
virtual int | getUserAttributesByKeys (const char *userId, const char *attributeKeys[], int numberOfKeys, long long &requestId)=0 |
virtual int | setChannelAttributes (const char *channelId, const IRtmChannelAttribute *attributes[], int numberOfAttributes, const ChannelAttributeOptions &options, long long &requestId)=0 |
virtual int | addOrUpdateChannelAttributes (const char *channelId, const IRtmChannelAttribute *attributes[], int numberOfAttributes, const ChannelAttributeOptions &options, long long &requestId)=0 |
virtual int | deleteChannelAttributesByKeys (const char *channelId, const char *attributeKeys[], int numberOfKeys, const ChannelAttributeOptions &options, long long &requestId)=0 |
virtual int | clearChannelAttributes (const char *channelId, const ChannelAttributeOptions &options, long long &requestId)=0 |
virtual int | getChannelAttributes (const char *channelId, long long &requestId)=0 |
virtual int | getChannelAttributesByKeys (const char *channelId, const char *attributeKeys[], int numberOfKeys, long long &requestId)=0 |
virtual int | getChannelMemberCount (const char *channelIds[], int channelCount, long long &requestId)=0 |
virtual int | setLogFile (const char *logfile)=0 |
virtual int | setLogFilter (LOG_FILTER_TYPE filter)=0 |
virtual int | setLogFileSize (int fileSizeInKBytes)=0 |
Protected Member Functions |
|
virtual | ~IRtmService () |
|
inlineprotectedvirtual |
|
pure virtual |
Initializes an IRtmService instance.
All methods in the IRtmService class are executed asynchronously.
appId | The App ID issued by Agora to you. Apply for a new App ID from Agora if it is missing from your kit. |
eventHandler | An IRtmServiceEventHandler object that invokes callbacks to be passed to the application on Agora RTM SDK runtime events. |
|
pure virtual |
Adds an IRtmServiceEventHandler object.
eventHandler | An IRtmServiceEventHandler object. |
|
pure virtual |
Removes an IRtmServiceEventHandler object.
eventHandler | An IRtmServiceEventHandler object. |
|
pure virtual |
Releases all resources used by the IRtmService instance.
|
pure virtual |
Logs in the Agora RTM system.
token |
Token used to log in the Agora RTM system and used when dynamic authentication
is enabled. Set token as nil in the integration and
test stages.
|
userId |
The user ID of the user logging in Agora's RTM system. The string must not
exceed 64 bytes in length. It cannot be empty, null or "null". Supported
characters:
|
|
pure virtual |
Logs out of the Agora RTM system.
The local user receives the onLogout callback. See LOGIN_ERR_CODE for the error codes.
|
pure virtual |
Renews the RTM Token of the SDK.
You are required to renew your RTM Token when receiving the onTokenExpired callback, and the onRenewTokenResult callback returns the result of this method call. The call frequency limit for this method is 2 calls per second.
token | Your new RTM Token. You need to generate the RTM Token yourself. See Generate an RTM Token. |
|
pure virtual |
peerId | User ID of the receiver. |
message | The message to be sent. For information about creating a message, see IMessage. |
|
pure virtual |
Downloads a file or image from the Agora server to the local memory by media ID.
The SDK returns the result of this method call by the onMediaDownloadToMemoryResult callback.
mediaId | The media ID of the file or image on the Agora server. |
requestId | The unique ID of this download request. |
|
pure virtual |
Downloads a file or image from the Agora server to a specified local directory by media ID.
The SDK returns the result of this method call by the onMediaDownloadToFileResult callback.
mediaId | The media ID of the file or image on the Agora server. |
filePath | The full path to the downloaded file or image. Must be in UTF-8. |
requestId | The unique ID of this download request. |
|
pure virtual |
Cancels an ongoing file or image download task by request ID.
The SDK returns the result of this method call with the onMediaCancelResult callback.
requestId | The unique ID of the download request to cancel. |
|
pure virtual |
Cancels an ongoing file or image upload task by request ID.
The SDK returns the result of this method call with the onMediaCancelResult callback.
requestId | The unique ID of the upload request to cancel. |
|
pure virtual |
Sends an (offline) peer-to-peer message to a specified user (receiver).
This method allows you to send a message to a specified user when he/she is offline. If you set a message as an offline message and the specified user is offline when you send it, the RTM server caches it. Please note that for now we only cache 200 offline messages for up to seven days for each receiver. When the number of the cached messages reaches this limit, the newest message overrides the oldest one.
If you use this method to send off a text message that starts off with AGORA_RTM_ENDCALL_PREFIX_<channelId>_<your additional information>, then this method is compatible with the endCall method of the legacy Agora Signaling SDK. Replace <channelId> with the channel ID from which you want to leave (end call), and replace <your additional information> with any additional information. Note that you must not put any "_" (underscore" in your additional information but you can set \<your additional information\> as empty "". - The \ref agora::rtm::IRtmServiceEventHandler::onSendMessageResult "onSendMessageResult" callback returns the result of this method call. - When the message arrives at the receiver, the receiver receives the \ref agora::rtm::IRtmServiceEventHandler::onMessageReceivedFromPeer "onMessageReceivedFromPeer" callback. If you use this method to send off a <i>text</i> message that starts off with AGORA_RTM_ENDCALL_PREFIX_\<channelId\>_\<your additional information\>, then this method is compatible with the endCall method of the legacy Agora Signaling SDK. Replace \<channelId\> with the channel ID from which you want to leave (end call), and replace \<your additional information\> with any additional information. Note that you must not put any "_" (underscore" in your additional information but you can set <your additional information> as empty "".
peerId |
User ID of the receiver. The string must not exceed 64 bytes in length. It
cannot be empty, null, or "null". Supported characters:
|
message | The message to be sent. For information about creating a message, See IMessage. |
options | Options when sending the message to a peer. See SendMessageOptions. |
|
pure virtual |
Creates an Agora RTM channel.
null
.channelId |
The unique channel name. A channelId cannot be empty, null, or
"null". Must be less than 64 bytes in length. Supported characters:
|
eventHandler | See IChannelEventHandler. |
channelId
does not exist, the
method returns the created channel instance. If a channel with the same
channelId
already exists, the method returns the existing channel
instance.
channelId
is invalid or you have
joined the maximum number of channels.
|
pure virtual |
Gets an IRtmCallManager object.
Each IRtmService object corresponds to a unique IRtmCallManager object. That said, the IRtmCallManager object is IRtmService-specific.
eventHandler | An IRtmCallEventHandler object. |
|
pure virtual |
Creates an empty text IMessage instance.
|
pure virtual |
|
pure virtual |
Creates a raw IMessage instance.
rawData | The starting address of the raw message. |
length | Length of the raw message. Must not exceed 32 KB in length. |
|
pure virtual |
Creates a raw IMessage instance and sets its description.
description
as "" and add a brief text description of the
raw message at a later point using the
setText
method, but please ensure that the size of the raw message and the description
combined does not exceed 32 KB.
rawData | The starting address of the raw message. |
length | The length of the raw message. Must not exceed 32 KB in length. |
description | A brief text description of the raw message. If you set a text description, ensure that the size of the raw message and the description combined does not exceed 32 KB. |
|
pure virtual |
Creates an IFileMessage instance by media ID.
mediaId | The media ID of an uploaded file on the Agora server. |
|
pure virtual |
Creates an IImageMessage instance by media ID.
mediaId | The media ID of an uploaded image on the Agora server. |
|
pure virtual |
Gets an IFileMessage instance by uploading a file to the Agora server.
The SDK returns the result with the agora::rtm::IRtmServiceEventHandler::onFileMediaUploadResult callback. If success, this callback returns a corresponding IFileMessage instance.
filePath | The full path to the local file to upload. Must be in UTF-8. |
requestId | The unique ID of this upload request. |
|
pure virtual |
Gets an IImageMessage instance by uploading an image to the Agora server.
The SDK returns the result by the agora::rtm::IRtmServiceEventHandler::onImageMediaUploadResult callback. If success, this callback returns a corresponding ImageMessage instance.
filePath | The full path to the local image to upload. Must be in UTF-8. |
requestId | The unique ID of the upload request. |
|
pure virtual |
Creates an IRtmChannelAttribute instance.
|
pure virtual |
Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options.
parameters | SDK options in the JSON format. |
|
pure virtual |
Queries the online status of the specified users.
The SDK returns the result by the onQueryPeersOnlineStatusResult callback.
peerIds[] | An array of the specified user IDs. |
peerCount | Length of the list. |
requestId | The unique ID of this request. |
|
pure virtual |
Subscribes to the online status of the specified users.
The SDK returns the result by the onSubscriptionRequestResult callback.
peerIds | An array of the specified user IDs. |
peerCount | Length of the peer list. |
requestId | The unique ID of this request. |
|
pure virtual |
Unsubscribes from the online status of the specified users.
The SDK returns the result by the onSubscriptionRequestResult callback.
peerIds | An array of the specified user IDs. |
peerCount | Length of the peer list. |
requestId | The unique ID of this request. |
|
pure virtual |
Gets a list of the peers, to whose specific status you have subscribed.
The SDK returns the result by the onQueryPeersBySubscriptionOptionResult callback.
option | The status type, to which you have subscribed. See PEER_SUBSCRIPTION_OPTION. |
requestId | The unique ID of this request. |
|
pure virtual |
Substitutes the local user's attributes with new ones.
The SDK returns the result by the onSetLocalUserAttributesResult callback.
attributes | The new attributes. See RtmAttribute. |
numberOfAttributes | The number of the attributes. |
requestId | The unique ID of this request. |
|
pure virtual |
Adds or updates the local user's attribute(s).
This method updates the local user's attribute(s) if it finds that the attribute(s) has/have the same key(s), or adds attribute(s) to the local user if it does not.
The SDK returns the result by the onAddOrUpdateLocalUserAttributesResult callback.
attributes | The attrubutes to be added or updated. See RtmAttribute. |
numberOfAttributes | The number of the attributes. |
requestId | The unique ID of this request. |
|
pure virtual |
Deletes the local user's attributes by attribute keys.
The SDK returns the result by the onDeleteLocalUserAttributesResult callback.
attributeKeys | An array of the attribute keys to be deleted. |
numberOfKeys | Number of the attribute keys. |
requestId | The unique ID of this request. |
|
pure virtual |
Clears all attributes of the local user.
The SDK returns the result by the onClearLocalUserAttributesResult callback.
requestId | The unique ID of this request. |
|
pure virtual |
Gets all attributes of a specified user.
The SDK returns the result by the onGetUserAttributesResult callback.
userId | The user ID of the specified user. |
requestId | The unique ID of this request. |
|
pure virtual |
Gets the attributes of a specified user by attribute keys.
The SDK returns the result by the onGetUserAttributesResult callback.
userId | The user ID of the specified user. |
attributeKeys | An array of the attribute keys. |
numberOfKeys | The number of the attribute keys. |
requestId | The unique ID of this request. |
|
pure virtual |
Resets the attributes of a specified channel.
The SDK returns the result by the onSetChannelAttributesResult callback.
channelId | The channel ID of the specified channel. |
attributes | An array of channel attributes. See IRtmChannelAttribute. |
numberOfAttributes | The total number of the channel attributes. |
options | Options for this attribute operation. See ChannelAttributeOptions. |
requestId | The unique ID of this request. |
|
pure virtual |
Adds or updates the attribute(s) of a specified channel.
This method updates the specified channel's attribute(s) if it finds that the attribute(s) has/have the same key(s), or adds attribute(s) to the channel if it does not.
The SDK returns the result by the onAddOrUpdateChannelAttributesResult callback.
channelId | The channel ID of the specified channel. |
attributes | An array of channel attributes. See IRtmChannelAttribute. |
numberOfAttributes | The total number of the channel attributes. |
options | Options for this attribute operation. See ChannelAttributeOptions. |
requestId | The unique ID of this request. |
|
pure virtual |
Deletes the attributes of a specified channel by attribute keys.
The SDK returns the result by the onDeleteChannelAttributesResult callback.
channelId | The channel ID of the specified channel. |
attributeKeys | An array of channel attribute keys. |
numberOfKeys | The total number of the channel attributes. |
options | Options for this attribute operation. See ChannelAttributeOptions. |
requestId | The unique ID of this request. |
|
pure virtual |
Clears all attributes of a specified channel.
The SDK returns the result by the onClearChannelAttributesResult callback.
channelId | The channel ID of the specified channel. |
options | Options for this attribute operation. See ChannelAttributeOptions. |
requestId | The unique ID of this request. |
|
pure virtual |
Gets all attributes of a specified channel.
The SDK returns the result by the onGetChannelAttributesResult callback.
channelId | The channel ID of the specified channel. |
requestId | The unique ID of this request. |
|
pure virtual |
Gets the attributes of a specified channel by attribute keys.
The SDK returns the result by the onGetChannelAttributesResult callback.
channelId | The channel ID of the specified channel. |
attributeKeys | An array of attribute keys. |
numberOfKeys | The total number of the attribute keys. |
requestId | The unique ID of this request. |
|
pure virtual |
Gets the member count of specified channels.
The SDK returns the result by the onGetChannelMemberCountResult callback.
channelIds | An array of the specified channel IDs. |
channelCount | The total number of the channels. |
requestId | The unique ID of this request. |
|
pure virtual |
Specifies the default path to the SDK log file.
logfile |
The absolute file path to the log file. The string of logfile is in
UTF-8.
|
|
pure virtual |
Sets the output log level of the SDK.
You can use one or a combination of the filters. The log level follows the sequence of OFF, CRITICAL, ERROR, WARNING, and INFO. Choose a level to see the logs preceding that level. If, for example, you set the log level to WARNING, you see the logs within levels CRITICAL, ERROR, and WARNING.
filter | The log filter level. See LOG_FILTER_TYPE. |
|
pure virtual |
Sets the size of a single log file. The SDK has two log files with the same size.
fileSizeInKBytes |
The size of a single log file (KB). For RTM C++ SDK for Windows, the default is
10240 (KB). For RTM C++ SDK for Linux, the default is
102400 (KB). The value range is [512 KB, 1 GB].
|