Skip to main content

Sending Messages

Description

Method for sending messages

Text Messages

Image Messages

Custom Messages

Reference custom messages: Custom Messages

Message Storage Callback (Not Message Send Status)

When sending messages, the SDK will trigger a storage callback after saving the message to the local database. At this point, the message has not been sent yet, and you can display the message in the UI in this listener.

New Messages

Listen for new message events

Message Refresh

When the SDK updates messages, such as: message send status, someone likes a message, message read receipt, message recall, message editing, etc., the SDK will callback the following event. The UI can determine which specific message has changed through the clientMsgNO of the message object WKMsg.

Message Send Status Code (ReasonCode)

When a message is sent, the reasonCode in the WKMsg object returned by the addRefreshListener indicates the result of the message delivery. Below are the descriptions for each status code:

View Chat Information for a Channel

Getting history messages is not a synchronous method, as there may be non-continuous data that needs to be synced from the server

Complete Message Management Example

Offline Messages

Need to implement sync channel message data source Channel Message Data Source Because WuKongIM supports permanent message storage, it will generate massive offline messages. For this, we adopt an on-demand pull mechanism. For example, with 10 conversations each having 100,000 messages, WuKongIM will not pull all 10*100,000=1 million messages to local storage. Instead, it pulls information for these 10 conversations and the corresponding latest 20 messages, which means actually only 200 messages are pulled. Compared to 1 million messages, this greatly improves offline pull speed. Users will only pull messages for a specific conversation when they enter that conversation. These mechanisms are already encapsulated within the SDK, so users don’t need to worry about them. Users only need to focus on recent conversation changes and listen for data retrieval callbacks.

Data Structure Description

Message Structure

Message Content Structure

Next Steps

Channel Management

Learn how to manage channels and groups

Conversation Management

Handle conversation lists and unread messages

Data Source Configuration

Configure message data sources

Advanced Features

Explore advanced features and custom messages