Read receipts
Required setup
Read Receipts requires Unread Message Count. First, set the last read timetoken for each user on a channel.
Read receipts show if channel members have viewed a message.
Get read receipts
StreamReadReceipts() provides read status for messages on a channel. The method fetches member read status, listens for updates, and passes receipt events to your callback.
Not available for public chats
Read receipts are disabled in public chats.
Method signature
- Blueprint
- C++ / Input parameters
1Channel->StreamReadReceipts(FOnPubnubChannelStreamReadReceiptsReceived ReadReceiptsCallback);
* required
| Parameter | Description |
|---|---|
ReadReceiptsCallback *Type: FOnPubnubChannelStreamReadReceiptsReceivedDefault: n/a | Callback function passed as a parameter. It defines the custom behavior to be executed when receiving a read confirmation status on the joined channel. |
Output
| Type | Description |
|---|---|
UPubnubCallbackStop* | Object on which you can call Stop() to stop receiving updates. |
Sample code
Receive updates for read receipts on the support channel.
1#include "Kismet/GameplayStatics.h"
2#include "PubnubChatSubsystem.h"
3
4UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
5UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();
6
7UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");
8
9UPubnubChannel* Channel = Chat->GetChannel("support");
10
11// Create a pubnub response delegate
12// you MUST implement your own callback function to handle the response
13FOnPubnubChannelStreamReadReceiptsReceived ReadReceiptsUpdatesOnResponse;
14ReadReceiptsUpdatesOnResponse.BindDynamic(this, &AMyActor::OnReadReceiptsResponseReceived);
15
show all 19 lines