Read receipts
Read receipts show if channel members have viewed a message.
Required setup
Read Receipts requires Unread Message Count. First, set the last read timetoken for each user on a channel.
Get read receipts
StreamReadReceipts() provides read status for messages on a channel. Use OnReadReceiptEvent to handle updates.
Not available for public chats
Read receipts are disabled in public chats.
Method naming
Earlier versions used SetListeningForReadReceiptsEvents() to enable streaming. This method has been superseded by StreamReadReceipts(), though it remains available for backward compatibility.
Method signature
These methods take the following parameters:
-
StreamReadReceipts()1channel.StreamReadReceipts(bool stream) -
OnReadReceiptEvent- Event signature1// event on the Channel entity
2public event Action<Dictionary<string, List<string>>> OnReadReceiptEvent;
3// needs a corresponding event handler
4void EventHandler(Dictionary<string, List<string>> readEvent)
Input
| Parameter | Required in StreamReadReceipts() | Required in OnReadReceiptEvent | Description |
|---|---|---|---|
streamType: boolDefault: n/a | Yes | n/a | Whether to start (true) or stop (false) listening to read receipt events on the channel. |
readEventType: Dictionary<string, List<string>>Default: n/a | No | Yes | A dictionary where keys are channel IDs and values are lists of user IDs who read messages on those channels. |
Output
These methods don't return a value. Read receipt updates are delivered through the OnReadReceiptEvent event handler.
Sample code
Receive updates for read receipts on the support channel.
1