reSendMessage
Introduction
Re-send a message.
You are supposed to invoke this method, to re-send a message failed to sent in previous, may as the reason of bad network conditions, or other restrictions.
The actual failure reason can refer to the error code.
The original message needs to be deleted, before re-send it.
Parameter details
Parameter name | Parameter type | Required | Platform | Description |
---|---|---|---|---|
msgID | String | yes | All | The id of the message to re-send. |
onlineUserOnly | bool | no | All | Should only send the message to online users. |
webMessageInstatnce | Object | no | All | The message instance on Web. |
Returned template
V2TimValueCallback<V2TimMessage>
{
code : int
desc : String
data : {
cloudCustomData : String
customElem : V2TimCustomElem
elemType : int
faceElem : V2TimFaceElem
faceUrl : String
fileElem : V2TimFileElem
friendRemark : String
groupAtUserList : List<String>
groupID : String
groupTipsElem : V2TimGroupTipsElem
id : String
imageElem : V2TimImageElem
isExcludedFromLastMessage : bool
isExcludedFromUnreadCount : bool
isPeerRead : bool
isRead : bool
isSelf : bool
localCustomData : String
localCustomInt : int
locationElem : V2TimLocationElem
mergerElem : V2TimMergerElem
messageFromWeb : String
msgID : String
nameCard : String
needReadReceipt : bool
nickName : String
offlinePushInfo : V2TimOfflinePushInfo
priority : int
progress : int
random : int
sender : String
seq : String
soundElem : V2TimSoundElem
status : int
textElem : V2TimTextElem
timestamp : int
userID : String
videoElem : V2TimVideoElem
}
}
Return value details
name | type | description |
---|---|---|
code | int | Request result: Error codes. 0 means success. |
desc | String | The description of the failure. |
data | V2TimMessage | The message after re-send. |
Code example
V2TimValueCallback<V2TimMsgCreateInfoResult> createTextMessageRes =
await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.createTextMessage(
text: "test",
);
if (createTextMessageRes.code == 0) {
String? id = createTextMessageRes.data?.id;
V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
.v2TIMManager
.getMessageManager()
.sendMessage(id: id!, receiver: "userID", groupID: "groupID");
if (sendMessageRes.code == 0) {
} else {
V2TimValueCallback<V2TimMessage> reSendMessageRes =
await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.reSendMessage(
msgID: id,
onlineUserOnly: false,
webMessageInstatnce: "");
if (reSendMessageRes.code == 0) {
}
}
}