Delete channels
Unreal Chat SDK lets you remove an existing channel using the DeleteChannel()
methods.
Both of these methods give the same output. The only difference is that you call a given method either on the Chat
or the Channel
object. Depending on the object, these methods take a different set of input parameters - you either have to specify the channel ID you want to delete or not because it's already known.
Requires App Context
To store data about channels, you must enable App Context for your app's keyset in the Admin Portal.
Delete a channel (hard delete)
Method signature
- Blueprint
- C++ / Input parameters
-
Channel->DeleteChannel()
Channel->DeleteChannel()
-
Chat->DeleteChannel()
Chat->DeleteChannel(FString ChannelID)
Parameter | Type | Required in Channel->DeleteChannel() | Required in Chat->DeleteChannel() | Default | Description |
---|---|---|---|---|---|
ChannelID | FString | No | Yes | n/a | Unique channel identifier. |
Output
These methods don't return any value.
Basic usage
Delete the support
channel metadata.
-
Channel->DeleteChannel()
#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");
Channel->DeleteChannel(); -
Chat->DeleteChannel()
#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");
Chat->DeleteChannel(Channel);