Receive messages in a channel
Messages sent from other participants or members in open and group channels can be received through the onMessageReceived()
method in the channel event handler, which can be used as a mixin. A BaseMessage
object for each received message is one of the following three message types.
Message type | Class | Description |
---|---|---|
Text | A text message sent by a user | |
File | A binary file message sent by a user | |
Admin | A text message sent by an admin through the Chat Platform API. |
In cases where multiple handlers need to be registered concurrently, pass the handler's unique ID for the UNIQUE_HANDLER_ID
argument in addChannelEventHandler
.
If you no longer need to listen to the event handler and receive messages, remove the channel event handler by following the implementation below.
Receive a reply in a message thread
Once a reply is created or deleted from a thread, the onThreadInfoUpdated()
method of channel event handlers is invoked. The method returns a ThreadInfoUpdateEvent
object that has the latest information about the thread. This object needs to be applied to the parent message object.
Note: Like other messages, when a reply is created in a channel, the
onMessageReceived()
method of the channel event handler in client apps will be called.
List of parameters
Parameter name | Type | Description |
---|---|---|
channel | BaseChannel | Specifies the channel that has the message thread. |
event | ThreadInfoUpdateEvent | Specifies a |
Receive callbacks for delivery receipts
When a message is delivered to group channel members who are online, it is automatically marked as delivered and channel members are also notified of the successful message delivery through the onDeliveryStatusUpdated()
method in the channel event handler.