/ SDKs / Unreal
Chat SDKs Unreal v3
Chat SDKs Unreal
Chat SDKs
Version 3

Mark messages as read

Copy link

To keep the most up-to-date and accurate read status of messages for all group channel members, the MarkAsRead() method should be called every time one of the members reads messages by entering the channel from a channel list.

If the current user opens a channel and the MarkAllAsRead() is called, Sendbird server will update both the unread message count of the individual channel and the total unread message count of all the group channels joined by the user. The server then notifies the change of read status to all members' devices through the ReadReceiptUpdated() method in the channel event handler, except the one that is being used by the current user.

Note : When a channel member sends a message to the channel, Sendbird server updates the member's read receipt to the time when the message has sent. Meanwhile, the read receipts of other channel members can be updated when the MarkAsRead() method is called. If a new member joins the channel, the method works differently based on the value of the display_past_message property of your Sendbird application. If the property is set to true, the new member’s read receipt will be updated to the sent time of the last message in the channel. If false, it will be updated to 0.

// Call the 'MarkAsRead()' when the current user views unread messages in a group channel.

// To listen to an update from all the other channel members' client apps, implement the ReadReceiptUpdated() with things to do when notified.
class MyChannelHandler : public SBDChannelHandler {
    void ReadReceiptUpdated(SBDGroupChannel* groupChannel) {
        if (groupChannel->channel_url.compare(currentGroupChannel->channel_url) == 0) {
            // For example, code for redrawing a channel view.

SBDMain::AddChannelHandler(UNIQUE_HANDLER_ID, new MyChannelHandler());

Note: The display_past_message property determines whether to display past messages to newly joined members when they enter the channel. This property is also linked to the Chat history option, which can be changed on Sendbird Dashboard under Settings > Chat > Channels > Group channels.