Delete local message
Delete a single message from the current device only.
Deletes a single message record from the local device database without affecting server records or other clients.
Code example
import sdk, { DeleteMessageFromLocalReq } from '@openimsdk/imsdk';
const request: DeleteMessageFromLocalReq = {
conversationID: conversationID,
clientMsgID: message.clientMsgID,
};
await sdk.deleteMessageFromLocal(request);
removeMessage(conversationID, message.clientMsgID);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | string | Yes | Target conversation identifier. |
clientMsgID | string | Yes | Client message identifier of the target message. |
Return value
Returns a Promise that resolves to void when the local message record is deleted.
State changes after the call
Both IDs should come from the active conversation context and the target message object. Remove the item from UI state by matching clientMsgID (qualified by conversationID if needed). Promise resolution indicates only that the message was removed from the local device database; server records may still exist and could re-synchronize after full database rebuilds. This action does not broadcast events to other devices or conversation participants. For multi-device synchronized deletion, see Batch delete messages; for message revocation, see Revoke message.
Was this page helpful?