onRecvNewMessages
Feature Introduction
info
This callback is triggered when new messages are received, possibly containing multiple messages.
- uni-app
- Browser/Electron/MiniProgram
Return Prototype
Return Prototype
Parameter Details
Return Prototype
onRecvNewMessages(data: WSEvent<MessageItem[]>): void;
Return Results
Name | Type | Description |
---|---|---|
data | WSEvent<MessageItem[]> | New messages |
Usage Example
import { getSDK, CbEvents } from '@openim/wasm-client-sdk';
// or
// import { OpenIMSDK, CbEvents } from 'open-im-sdk';
// const IMSDK = new OpenIMSDK();
const IMSDK = getSDK();
IMSDK.on(CbEvents.OnRecvNewMessages, ({ data }) => {
// data is the list of new messages
});
Return Prototype
onRecvNewMessages(data: WSEvent<MessageItem[]>): void;
Return Results
Name | Type | Description |
---|---|---|
data | WSEvent<MessageItem[]> | New messages |
Usage Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.subscribe(IMSDK.IMEvents.OnRecvNewMessages, ({ data }) => {
// data is the list of new messages
});