WuKongIM HarmonyOS SDK advanced features, including custom message types and extension functionality
Advanced features provide developers with the ability to extend WuKongIM HarmonyOS SDK, including custom message types, message extensions, message receipts and other enterprise-level features.
In WuKongIM, all message types are custom messages
Sometimes we need to send messages with attachments when sending messages. WuKongIM also provides custom attachment messages, which are not much different from regular messages. Below we use location messages as an example.
As business develops, applications have increasingly more features in chat. To meet most requirements, WuKongIM has added message extension functionality. Message extensions are divided into local extensions and remote extensions. Local extensions are only for local app use and will be lost after uninstalling the app. Remote extensions are saved on the server and data will be restored after uninstalling and reinstalling.
Message read/unread is also called message receipts. Message receipt functionality can be set through settings.
Copy
let option = new WKSendOptions();option.setting.receipt = 1; // Enable receipts// Send messageWKIM.shared.messageManager().sendWithOption(textModel, channel, option);
When a logged-in user views messages sent by others, if the sender has enabled message receipts, the viewed messages need to be uploaded to the server to mark them as read. When the sender or yourself uploads read messages, the business server will send a sync message extension cmd (command) message syncMessageExtra. At this time, you need to sync the latest message extensions and save them to the SDK.
In chat, if there are too many messages, sending message replies will make the messages very messy and hard to follow. At this time, you need to make specific replies to certain messages, which is message reply.When sending a message, you just need to assign the WKReply object in the message content WKMessageContent to achieve the message reply effect.
Copy
let textModel: WKTextContent = new WKTextContent(this.sendContent);textModel.reply = new WKReply();textModel.reply.messageId = '';// Set other field information// Send messageWKIM.shared.messageManager().send(textModel, channel);
The same user can only make one reaction to the same message. Repeated reactions with different emojis to the same message will be treated as modifying the reaction, while repeated reactions with the same emoji will be treated as deleting the reaction
After the SDK updates message reactions, it will trigger a message refresh event. The app needs to listen for this event and refresh the UI.Listen for message reaction refresh:
HarmonyOS SDK has now completed all core functionality documentation:✅ Integration Guide - Complete installation and configuration guidance
✅ Basic Features - Connection management and basic APIs
✅ Message Management - Message sending/receiving and history messages
✅ Channel Management - Channel information and member management
✅ Conversation Management - Conversation lists and unread messages
✅ Data Source Configuration - File upload and data synchronization
✅ Advanced Features - Custom messages and extension featuresHarmonyOS SDK documentation is now fully complete, providing developers with comprehensive technical guidance from beginner to advanced levels! 🎉