Set message local extension
Store custom device-local extension strings on a message without synchronizing across devices.
The localEx property persists data exclusively on the local device, making it ideal for UI state such as folded states, selection checkboxes, local origin tags, or cached voice transcription text. It is never transmitted across the network or synchronized to other devices.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | string | Yes | Identifier of the conversation containing the message. |
clientMsgID | string | Yes | The clientMsgID of the target message. |
localEx | string | Yes | Complete serialized local extension string to store. |
The SDK does not merge JSON properties automatically. If multiple application components use localEx, parse the existing string, update the relevant properties, and serialize the complete payload back into localEx to avoid clobbering existing data.
Code example
import { setMessageLocalEx } from '@/uni_modules/unix-openim-sdk'
const clientMsgID = message.clientMsgID
if (clientMsgID == null) return
const nextLocalEx = JSON.stringify({
selected: true,
transcript: 'Transcribed text',
})
await setMessageLocalEx({
conversationID,
clientMsgID,
localEx: nextLocalEx,
})Return value
The Promise resolves with void upon successful local database persistence.
State changes after the call
Promise resolution indicates that the local database record was updated. Update the localEx property in your active message list item keyed by conversationID:clientMsgID. This operation does not emit shared network message events.
Was this page helpful?