SDKsReact Native
Insert local single message
Insert a message directly into local storage for a one-to-one chat without sending over the network using the OpenIM React Native SDK.
Write a one-to-one message directly into local device database storage:
This method saves the message exclusively in the local client database without transmitting network packets to the server or conversation counterparty. It is ideal for inserting local greeting prompts, service guidelines, or temporary UI placeholders.
const localMessage = await OpenIMSDK.insertSingleMessageToLocalStorage({
message,
recvID,
sendID,
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
message | MessageItem | Yes | Complete message object to store locally, typically constructed via message creation methods. |
recvID | string | Yes | Recipient user ID for the one-to-one chat. |
sendID | string | Yes | Sender user ID, which can be the current user or a virtual system user ID. |
Return value
A resolved Promise returns the MessageItem written to the local database. The message is indexed locally by clientMsgID. To dispatch messages over the network to the counterparty, use Send message.
Was this page helpful?