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

Clear conversation messages

Retain the conversation entry while clearing all stored messages and message summaries for the authenticated account.

Copy

Invoke clearConversationAndDeleteAllMsg() to retain the conversation entry in the list while wiping all locally stored messages and message summaries for the current account. Once executed, the SDK cannot recover these deleted messages from local storage.

Parameters

ParameterTypeRequiredDescription
conversationIDstringYesIdentifier of the target conversation.

Code example

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

await clearConversationAndDeleteAllMsg(conversationID)

To remove both the conversation record and its messages simultaneously, see Delete conversation with messages.

Return value

The Promise resolves with void upon successful completion.

State changes after the call

Upon Promise resolution, immediately empty the active chat message view model. The SDK then emits onConversationChanged, where you should update the conversation's latestMsg, latestMsgSendTime, and unread indicators using conversationID as the primary key. For the centralized conversation list listener, see Retrieve conversation list.