Restore messages
Requires Message Persistence
Enable Message Persistence and Enable Delete-From-History in the Admin Portal.
Restore() recovers soft deleted messages and their attached files. Hard deleted messages cannot be restored.
Method signature
- Blueprint
- C++ / Input parameters
1Message->Restore();
Output
| Type | Description |
|---|---|
UPubnubMessage* | Object returning the restored Message object. |
Sample code
Restore a previously soft deleted message with the 16200000000000001 timetoken.
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
11FString Timetoken = "16200000000000001";
12
13// Fetch the message
14UPubnubMessage* Message = Channel->GetMessage(Timetoken);
15
show all 18 lines