Adds or updates the attributes of a specified channel.
This method updates the specified channel's attributes if it finds that the attributes has/have the same keys, or adds attributes to the channel if it does not.
Note
The channel ID of the specified channel.
An array of channel attributes.
Options for this attribute operation. See ChannelAttributeOptions.
Adds or updates the local user's attributes.
This method updates the local user's attributes if it finds that the attributes has/have the same keys, or adds attributes to the local user if it does not.
The attributes to be added or updated.
The Promise resolves after successfully adding or updating the local user's attributes.
Clears all attributes of a specified channel.
Note
The channel ID of the specified channel.
Options for this attribute operation. See ChannelAttributeOptions.
Clears all attributes of the local user.
The Promise resolves after successfully clearing the local user's attributes.
Creates an RtmChannel instance.
The unique channel name of the Agora RTM channel. The string length must be less than 64 bytes with the following character scope:
Note:
An RtmChannel instance.
Creates a LocalInvitation instance.
The uid of the callee.
A LocalInvitation instance.
Content of the file in binary format. Must not exceed 32 MB in size.
Contains the name of the file to upload, the description of the file message, the thumbnail, and the message type.
fileName
, description
, and thumbnail
is 32 KB.fileName
, description
, and thumbnail
is 32 KB.fileName
, description
, and thumbnail
is 32 KB.A MediaTransferHandler instance. You can use this parameter to cancel an upload or report the upload progress.
The Promise resolves after the file is successfully uploaded. The value of the Promise is an RtmFileMessage instance for sending channel messages and peer-to-peer messages.
Uploads an image to the Agora server to get an RtmImageMessage instance for sending image messages.
Content of the image in binary format. Must not exceed 32 MB in size.
Contains the the width, height, name of the image file to upload, the description of the image message, the thumbnail, the width and height of the thumbnail, and the message type.
fileName
, description
, and thumbnail
is 32 KB.fileName
, description
, and thumbnail
is 32 KB.fileName
, description
, and thumbnail
is 32 KB.A MediaTransferHandler instance. You can use this parameter to cancel an upload or report the upload progress.
The Promise resolves after the image file is successfully uploaded. The value of the Promise is an RtmImageMessage instance for sending channel messages and peer-to-peer messages.
Creates a message instance for sending peer-to-peer or channel messages.
A RtmMessage type.
An object that includes any property of RtmMessage.
A message instance to send. You can use the message instance to send peer-to-peer or channel messages.
Deletes the local user's attributes using attribute keys.
Note
The channel ID of the specified channel.
A list of channel attribute keys.
Options for this attribute operation. See ChannelAttributeOptions.
Deletes the local user's attributes using attribute keys.
A list of the attribute keys to be deleted.
The Promise resolves after successfully deleting the local user's attributes.
Media ID of the uploaded file or image file. The SDK automatically returns a media ID when a file or image file is successfully uploaded to the Agora server. You can use the RtmFileMessage instance or the RtmImageMessage instance to get the media ID of a file or image file.
A MediaTransferHandler instance. You can use this parameter to cancel a download or report the download progress.
The Promise is resolved when the download is complete. The value of the Promise is the Blob
instance that represents the downloaded file or image file.
Gets all attributes of a specified channel.
Note
The ID of the specified channel.
Gets the attributes of a specified channel by attribute keys.
Note
The ID of the specified channel.
An array of attribute keys.
Gets the member count of specified channels.
Note
An array of the specified channel IDs.
Gets all attributes of a specified user.
The user ID of the specified user.
Gets the attributes of a specified user by attribute keys.
The user ID of the specified user.
An array of the attribute keys.
Logs in to the Agora RTM system.
An optional token generated by the app server.
The uid of the user logging in the Agora RTM system. The string length must be less than 64 bytes with the following character scope:
Note
number
type and recommend using the toString()
method to convert your non-string uid.The Promise resolves after the user logs in to the Agora RTM system successfully.
Allows a user to log out of the Agora RTM system.
After the user logs out of the Agora RTM system, the SDK disconnects from the Agora RTM system and destroys the corresponding event listener.
The Promises resolves after the user logs out of the Agora RTM system and disconnects from WebSocket.
Adds the listener
function to the channel for the event named eventName
. See the EventEmitter
API documentation for other event methods on the RtmClient
instance.
The name of the RTM client event. See the property names in the RtmClientEvents for the list of events.
The callback function of the RTM client event.
Gets a list of the peers, to whose specific status you have subscribed.
The status type, to which you have subscribed. See RtmStatusCode.PeerSubscriptionOption.
Queries the online status of the specified users.
A list of the user IDs. The number of user IDs must not exceed 256.
Renews the token.
Your new Token.
Allows a user to send an (offline) peer-to-peer message to a specified remote user.
You can send messages, including peer-to-peer and channel messages at a maximum frequency of 180 calls every three second.
The message to be sent.
The uid of the peer user.
Enables offline messaging. See SendMessageOptions.
Note
We do not support uids of thenumber
type. We recommend using the toString()
method to convert a non-string uid.
The Promise resolves after the message is successfully sent. The value of the Promise indicates whether the peer user is online and receives the message.
Sets the attributes of a specified channel with new ones.
Note
The channel ID of the specified channel.
An array of channel attributes.
Options for this attribute operation. See ChannelAttributeOptions.
Substitutes the local user's attributes with new ones.
The new attributes.
The Promise resolves after successfully setting the local user's attributes.
Subscribes to the online status of the specified users.
Note
An array of the specified user IDs.
Unsubscribes from the online status of the specified users.
An array of the specified user IDs.
Class that represents the RTM client. You can call the createInstance method of AgoraRTM to create an
RtmClient
instance. This class is the entry point of the Agora RTM SDK.