TIMMsgReportReaded
Introduction
Report message read (C2C)
It is acceptable to fill out message with NULL, null string pointer, or "" empty string, and the latest message time (if exist) or the current time is reported as the message read time.
When specifying mesasge, then use the message's timestamp as the message read time. The best approach is to use the original message by requiring message list or message locator in order to avoid reconstruct message Json.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
msgReportReadedParams | MsgReportReadedParams | yes | Param of reporting message read |
Returned template
Promise<commonResult<string>>
{
code: TIMResult | TIMErrCode;
desc?: string | undefined;
json_param?: string | undefined;
json_params?: string | undefined;
user_data?: string | undefined;
}
Return value details
name | type | description |
---|---|---|
code | TIMResult | TIMErrCode | Request result: Error codes. 0 means success. |
desc | string | undefined | The description of the error. It will be empty if success. |
json_param | string | undefined | Return value of calling API |
json_params | string | undefined | Return value of calling API. Compatible field, which is returned in some cases. |
user_data | string | undefined | ImSDK is responsible for transporting user-defined data without any processing |
Code example
import TimRender from "im_electron_sdk/dist/renderer";
const timRenderInstance = new TimRender();
import { MsgReportReadedParams,MsgGetMsgListParams,Json_value_msg } from "im_electron_sdk/dist/interfaces";
let convId = ''
let convType = 0
let param2:MsgGetMsgListParams = {
conv_id:convId,
conv_type: convType,
params: {
msg_getmsglist_param_last_msg: null,
msg_getmsglist_param_count: 2,
msg_getmsglist_param_is_ramble: true,
},
user_data: ""
}
let m = await timRenderInstance.TIMMsgGetMsgList(param2);
let json_msg_param:Json_value_msg = m.json_params[0];
let param: MsgReportReadedParams = {
conv_id: convId, // required
conv_type: convType, // required
json_msg_param: json_msg_param, // optional
user_data: '' // optional
}
const { code } = await timRenderInstance.TIMMsgReportReaded(param);
if (code == 0) {
// success
}