SDKsWASM
Insert a local one-to-one message
Insert a local one-to-one message with the WASM SDK.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
message | MessageItem | Yes | Complete message object to write to the local database. |
recvID | string | Yes | User ID of the one-to-one recipient. |
sendID | string | Yes | User ID of the message sender. |
const { data: message } = await openimsdk.createTextMessage('Local notice');
await openimsdk.insertSingleMessageToLocalStorage({
message,
recvID: targetUserID,
sendID: currentUserID,
});When the Promise resolves, the message has been written only to the current device's local database. It is not sent and does not trigger a new-message event. createTextMessage() only prepares the parameter; its documentation belongs to Create a text message.
Was this page helpful?