Delete messages
Delete()
either permanently removes a historical message from Message Persistence (DeleteMessageHard()
) or marks it as deleted
if you use the soft delete option (DeleteMessage()
).
Requires Message Persistence configuration
To manage messages, you must enable Message Persistence for your app's keyset in the Admin Portal. To delete messages from PubNub storage, you must also mark the Enable Delete-From-History option.
Mark message as deleted (soft delete)
Method signature
This method applies to the Message
object the deleted
status so you can still restore/get its data.
- Blueprint
- C++ / Input parameters
// soft delete
Message->DeleteMessage();
Output
Type | Description |
---|---|
UPubnubMessage* | An updated message instance with an added deleted action type. |
Basic usage
Soft delete the message with the 16200000000000001
timetoken from the support
channel.
#include "Kismet/GameplayStatics.h"
#include "PubnubChatSubsystem.h"
UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();
UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");
UPubnubChannel* Channel = Chat->GetChannel("support");
FString Timetoken = "16200000000000001";
// Fetch the message
UPubnubMessage* Message = Channel->GetMessage(Timetoken);
show all 16 linesDelete a message (hard delete)
Method signature
This method permanently removes a message from Message Persistence.
- Blueprint
- C++ / Input parameters
// hard delete
Message->DeleteMessageHard();
Output
Type | Description |
---|---|
bool | Whether or not the deletion was successful. |
Basic usage
Permanently delete the message with the 16200000000000001
timetoken from the support
channel.
#include "Kismet/GameplayStatics.h"
#include "PubnubChatSubsystem.h"
UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();
UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");
UPubnubChannel* Channel = Chat->GetChannel("support");
FString Timetoken = "16200000000000001";
// Fetch the message
UPubnubMessage* Message = Channel->GetMessage(Timetoken);
show all 16 lines