TIMAddRecvNewMsgCallback
Introduction
Add receiving new message callback
If logged in, ImSDK will retrieve messages send to you. PS. It doesn't have to be the unread messages
Only messages that aren't stored in the local storage will be retrieved. (Eg. Message read from other platform, and retrieve latest conversation's last message, if it's not in the local storage, the message will appear in here)
Once logged in, ImSDK will retrieve offline messages. Register this callback before log in to prevent missing messages
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
params | TIMRecvNewMsgCallbackParams | yes | Param of adding receiving new message callback. |
Returned template
void
Return value details
This function has no return value
Code example
import TimRender from "im_electron_sdk/dist/renderer";
const timRenderInstance = new TimRender();
import { TIMRecvNewMsgCallbackParams } from "im_electron_sdk/dist/interfaces";
let param : TIMRecvNewMsgCallbackParams = {
callback: (data)=>{},
user_data: ""
}
timRenderInstance.TIMAddRecvNewMsgCallback(param);