Skip to main content
The chat manager is responsible for message data management, such as: message sending, message receiving, message updates, etc.
This documentation only covers core methods. For more details, check the [WKSDK shared].chatManager interface in the code.

Online Message Sending and Receiving

Sending Messages

Basic Send Method

Send Example

Message Listening

Add Listener

WKChatManagerDelegate Description

Message Send Status Code (ReasonCode)

When a message is sent, the reasonCode in the WKMessage object returned by the onMessageUpdate: or onMessageStatusUpdate: delegate methods indicates the result of the message delivery. Below are the descriptions for each status code:

Common Message Types

The SDK includes some common message types, such as text messages, image messages, and voice messages.

Text Messages

Usage Example

Image Messages

Usage Example

Voice Messages

Usage Example

Custom Messages

See Custom Messages for details.

Message Extensions

Some messages may need to carry additional information, such as message read status, whether the message has been edited, etc. This information can be implemented through message extension properties.

Update Extensions

The WKMessage class has a remoteExtra property. After modifying this property, you need to call this method to update the remote extension:

Sync Extensions

Incrementally sync all message extension data for a specified channel (this method is generally called once when opening a chat page):

Extension Data Source

Update Extension Data Source

Trigger timing: Triggered when calling [[WKSDK shared].chatManager updateMessageRemoteExtra]

Sync Extension Data Source

Trigger timing: Triggered when calling [[WKSDK shared].chatManager syncMessageExtra]

Message History

Query Latest Messages

Query the latest messages for a channel (generally called when first entering a conversation page to query first screen messages):

Pull Down to Load Messages

Pull Up to Load Messages

Query Messages Around

Message History Data Source

Trigger timing: When getting message history and the message doesn't exist locally, SDK will call this method to complete local messages Sync channel messages. When requesting message history, SDK will check if messages exist locally. If not or missing, SDK will call this method to request messages from server.

Core Class Properties

Message class core properties:
Message content core properties:

Next Steps

Channel Management

Learn how to manage channels and groups

Conversation Management

Handle conversation lists and unread messages

Media Messages

Handle images, voice, video and other multimedia messages

Advanced Features

Custom messages and advanced configuration