onRecvNewMessage
Feature Introduction
info
When a new message is received, this callback is triggered. The callback will carry only one message.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- Unity
Return Prototype
Function(Message msg)? onRecvNewMessage;
Return Result
Name | Type | Description |
---|---|---|
msg | Message | Message Body |
Return Prototype
- (void)onRecvNewMessage:(OIMMessageInfo *)msg;
Return Result
Name | Type | Description |
---|---|---|
msg | OIMMessageInfo | Message Body |
Return Prototype
void onRecvNewMessage(Message msg)
Return Result
Name | Type | Description |
---|---|---|
msg | Message | Message Body |
Return Prototype
onRecvNewMessage(data: WSEvent<MessageItem>): void;
Return Result
Name | Type | Description |
---|---|---|
data | WSEvent<MessageItem> | New Message |
Example Call
import { getSDK, CbEvents } from '@openim/wasm-client-sdk';
// or
// import { getSDK, CbEvents } from '@openim/client-sdk';
// const IMSDK = getSDK();
const IMSDK = getSDK();
IMSDK.on(CbEvents.OnRecvNewMessage, ({ data }) => {
// data is the new message
});
Return Prototype
onRecvNewMessage(data: WSEvent<MessageItem>): void;
Return Result
Name | Type | Description |
---|---|---|
data | WSEvent<MessageItem> | New Message |
Example Call
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.subscribe(IMSDK.IMEvents.OnRecvNewMessage, ({ data }) => {
// data is the new message
});