setMessageExtensions
Introduction
Set message extension
Supports since version 4.2.
This method only works with Ultimate Edition, you can find the pricing plan here.
Usage limitation: 1. the supportMessageExtension
should be set to true before the message was sent; 2. the message must be sent successfully; 3. The message couldn't be from the Community or the AVChatRoom.
If the extension key already exists, the extended value information will be modified. If the extension key does not exist, an extension will be added.
The maximum length of the extended key is 100 bytes, the maximum length of the extended value is 1KB.
Up to 20 extensions can be set once.
A message could be set with 300 extensions.
When multiple users set the same extended key at the same time, only the first user could set it successfully. The other users would receive the 23001 error code and the updated information. After receiving the error code and the latest information, please re set it as required.
We strongly suggest that different users set different extension key, so that most of the scenes won't conflict, such as voting, and investigation. You can use userID
as the extension key.
Parameter details
Parameter name | Parameter type | Required | Platform | Description |
---|---|---|---|---|
msgID | String | yes | All | Message id. |
extensions | List< V2TimMessageExtension > | yes | All | Message extension field. |
Returned template
V2TimValueCallback<List<V2TimMessageExtensionResult>>
{
code : int
desc : String
data : List<V2TimMessageExtensionResult>
}
Return value details
name | type | description |
---|---|---|
code | int | Request result: Error codes. 0 means success. |
desc | String | The description of the failure. |
data | List< V2TimMessageExtensionResult > | Result list of setting message extension operation. |
Code example
V2TimValueCallback<List<V2TimMessageExtensionResult>>
setMessageExtensionsRes = await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.setMessageExtensions(msgID: '',
extensions: []);
if (setMessageExtensionsRes.code == 0) {
}