Delete a local message
Delete a single message exclusively from local device storage.
Invoke deleteMessageFromLocalStorage() to remove a single message record exclusively from the local device database without affecting server-side storage or other chat participants.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | string | Yes | Identifier of the conversation containing the message. |
clientMsgID | string | Yes | The clientMsgID of the message to delete. |
Code example
import { deleteMessageFromLocalStorage } from '@/uni_modules/unix-openim-sdk'
const clientMsgID = message.clientMsgID
if (clientMsgID == null) return
await deleteMessageFromLocalStorage({
conversationID,
clientMsgID,
})
removeMessage(conversationID, clientMsgID)Both parameters must originate from verified conversation and message structures. Ensure clientMsgID is non-null before invoking the method.
Return value
The Promise resolves with void upon successful local deletion.
State changes after the call
Promise resolution indicates that the message record was purged from the local database. Immediately remove the message from your UI model using conversationID:clientMsgID. Because the server copy remains intact, clearing app data or switching devices may cause the message to re-synchronize. This call does not trigger notifications to other participants. To retract a message for everyone, see Revoke a message.
Was this page helpful?