Design Philosophy
To make it faster and more convenient for developers to use the SDK, WuKong SDK provides a single entry point to access all functions in the SDK. Like a table of contents in a book, you can find corresponding content through the directory. For example, connecting to IM:- Unified Entry: Access all functions through
WKIM.shared - Modular Management: Each functional module has clear responsibilities
- Easy Maintenance: Clear code structure, easy to debug and maintain
Architecture Overview
WuKongIM HarmonyOS SDK adopts a modular architecture design, where various modules work together to provide developers with complete instant messaging functionality:Core Functional Modules
Connection Manager (ConnectionManager)
Responsible for IM connection, disconnection, logout, listening for connection status, etc.Message Manager (MessageManager)
Responsible for CRUD operations on messages, new message listening, refresh message listening, message storage, etc.Conversation Manager (ConversationManager)
Responsible for CRUD operations on conversations, conversation list listening, conversation message listening, etc.Channel Manager (ChannelManager)
Can get Channel information, refresh Channel cache, listen for Channel changes [pin, do not disturb, mute], etc.Channel Member Manager (ChannelMemberManager)
Get Channel member list, set member remarks, save and modify member data, listen for refreshing members and removing members, etc.Reminder Manager (ReminderManager)
Get reminders for a conversation such as: [someone @me] [group join request], etc. You can also customize reminder items, such as unread voice messages, etc.Command Manager (CMDManager)
Responsible for listening to command messages sent by the server.SDK and APP Interaction Principles
WuKongIM HarmonyOS SDK adopts an event-driven interaction mode to ensure clear and controllable data flow:Interaction Flow Description
The SDK and APP interaction flow is that the APP calls the methods provided by the SDK, and after the SDK processes the data, it callbacks the data to the APP through events. For example, the message sending flow: APP calls the send message method, and the SDK pushes the stored message to the APP.- APP calls SDK methods: Application initiates operations through SDK-provided APIs
- SDK processes data: SDK internally handles business logic, including data validation, format conversion, etc.
- Network communication: SDK exchanges data with the server
- Event callbacks: SDK callbacks processing results to the application through event mechanisms
- UI updates: Application updates user interface based on callback data
Event Listening Example
Development Advantages
1. Simple and Easy to Use
- Unified Entry: All functions accessed through
WKIM.shared - Clear Structure: Modular design with clear responsibilities
- Rich Examples: Complete usage examples provided
2. Complete Functionality
- Full Platform Support: Optimized specifically for HarmonyOS platform
- Rich Message Types: Supports text, image, voice, video and other message types
- Custom Extensions: Supports custom message types and business logic
3. Performance Optimization
- Local Caching: Smart caching mechanism reduces network requests
- Incremental Sync: Only syncs changed data for improved efficiency
- Memory Management: Optimized memory usage, avoiding memory leaks
4. Stable and Reliable
- Auto Reconnection: Automatic reconnection during network exceptions
- Data Consistency: Ensures data integrity and consistency
- Error Handling: Comprehensive error handling mechanisms
5. HarmonyOS Feature Support
- ArkTS Language: Full support for ArkTS development language
- Component Architecture: Perfect integration with HarmonyOS component architecture
- Lifecycle Management: Synchronized with HarmonyOS application lifecycle
- Permission Management: Complies with HarmonyOS permission management standards

