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()1Channel->DeleteChannel() -
Chat->DeleteChannel()1Chat->DeleteChannel(FString ChannelID)
| Parameter | Required in Channel->DeleteChannel() | Required in Chat->DeleteChannel() | Description |
|---|---|---|---|
ChannelIDType: FStringDefault: n/a | No | Yes | Unique channel identifier. |
Output
These methods don't return any value.
Sample code
Delete the support channel metadata.
-
Channel->DeleteChannel()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
11Channel->DeleteChannel(); -
Chat->DeleteChannel()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
11Chat->DeleteChannel(Channel);