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. A SbBaseMessage
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 AddOpenChannelHandler()
or AddGroupChannelHandler()
.
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 SbThreadInfoUpdateEvent
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 |
---|---|---|
inChannel | SbBaseChannel | Specifies the channel that has the message thread. |
inThreadInfoUpdateEvent | 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.