onReceived

public boolean onReceived(Message message, int left, boolean hasPackage, boolean offline)

Receives real-time or offline messages.

Note: 1. For offline messages, the server packages 200 messages into a single bundle and sends it to the client, which then parses the bundle. 2. `hasPackage` indicates whether there are remaining message bundles, and `left` indicates how many messages are left in the current bundle after parsing and delivering them to the app layer. How to determine if all offline messages have been received: 1. Both `hasPackage` and `left` are 0; 2. `hasPackage` being 0 indicates that the client is receiving the last bundle (200 messages), and `left` being 0 indicates that the last message in the final bundle has been received.

Return

Whether the message was processed. Returns true if the app processed the message; otherwise, returns false for the SDK to handle.

Parameters

message

The received message object.

left

When the client successfully connects, the server sends all compensation messages in bundles, with a maximum of 200 messages per bundle (i.e., a Package). After receiving the bundle, the client parses it and notifies the app. `left` represents the number of remaining messages in the current bundle (Package).

hasPackage

Indicates whether there are undelivered message bundles on the server.

offline

Indicates whether the message is an offline message.