Browse SDKs · uni-app / uni-app x
SDKsuni-app

Clear messages in a conversation

OpenIM uni-app / uni-app x SDK guide for Clear messages in a conversation.

Copy

clearConversationAndDeleteAllMsg() clears every message from one conversation while keeping the conversation entry.

import { clearConversationAndDeleteAllMsg } from '@/uni_modules/unix-openim-sdk'

await clearConversationAndDeleteAllMsg(conversationID)

Ask for confirmation first and stop in-flight history pagination. Promise success means that Core completed the clear request; then clear the message store and requery the conversation so latest-message, sequence, and unread state come from Core.

This operation is different from deleting the conversation together with its messages. Use Delete a conversation and all messages when the conversation entry must also be removed.