- Android
- iOS
- JavaScript
- Flutter
- ReactNative
- HarmonyOS
Local message extensions apply only to messages on the current client and are not synchronized to remote clients.
Parameters
| Name | Type | Description | Version |
|---|---|---|---|
| clientMsgNo | long | Locally unique message number | 1.0.0 |
| attribute | String | Local attribute. JSON can be used for complex application scenarios. | 1.0.0 |
Code Example
JIM.getInstance().getMessageManager().setLocalAttribute(123L, "attribute1");
Local message extensions apply only to messages on the current client and are not synchronized to remote clients.
Parameters
| Name | Type | Description | Version |
|---|---|---|---|
| attribute | NSString | Local attribute. JSON can be used for complex application scenarios. | 1.0.0 |
| clientMsgNo | long long | Locally unique message number | 1.0.0 |
Code Example
[JIM.shared.messageManager setLocalAttribute:@"attribute1" forClientMsgNo:123];
Use this API to add special fields to local messages for different features. For example, add a local file path to a message in Electron. After the extension is set successfully, it is returned automatically when retrieving message history.
Parameters
| Name | Type | Required | Description | Version |
|---|---|---|---|---|
| message | Object | Yes | Message search parameters | 1.0.0 |
| message.tid | String | Yes | Unique message identifier. Available from Message. | 1.0.0 |
| message.attribute | String | Yes | JSON strings can be used for extensions, up to 1000 characters. | 1.0.0 |
Success Callback
No parameters are returned. The callback indicates success when invoked.
Failure Callback
| Name | Type | Description | Version |
|---|---|---|---|
| error | Object | A status code is provided when sending fails. Check error.msg directly or see status codes. | 1.0.0 |
Code Example
let message = {
tid: 'nrde5kxxaacg7sb5',
attribute: '{"fileUrl": "/Users/xxx/avatar.jpg"}'
};
jim.updateMessageAttr(message).then(() => {
console.log('Update Local Message successfully')
}, (error) => {
console.log(error)
});
Local message extensions apply only to messages on the current client and are not synchronized to remote clients.
Parameters
| Name | Type | Description | Version |
|---|---|---|---|
| msgId | string | Message ID | 1.0.0 |
| attribute | string | Local attribute. JSON can be used for complex application scenarios. | 1.0.0 |
Code Example
JuggleIm.instance.getMessageManager().setLocalAttribue("msgid1","json content")
Local message extensions apply only to messages on the current client and are not synchronized to remote clients.
Code Example
await JuggleIm.instance.setMessageLocalAttribute(
100, // message clientMsgNo
'localAttribute'
);