On this page

Delete channels

Remove a channel permanently with Delete().

Call Delete() on a Channel object or DeleteChannel() on the Chat object with the channel ID.

Requires App Context

Enable App Context for your keyset in the Admin Portal.

icon

Usage in Blueprints and C++


Asynchronous and synchronous method execution

Most PubNub Unreal SDK methods are available in both asynchronous and synchronous variants.

  • Asynchronous methods (Async suffix) return void and take an optional delegate parameter that fires when the operation completes.

    1Channel->DeleteAsync(OnDeleteResponseDelegate);

    You can also use native callbacks that accept lambdas instead of dynamic delegates. Native callback types have the Native suffix (for example, FOnPubnubChatOperationResponseNative).

  • Synchronous methods (no suffix) block the main game thread until the operation completes and return a result struct directly.

    1FPubnubChatOperationResult Result = Channel->Delete();

Delete a channel (hard delete)

Method signature

  • Channel->Delete()

    1Channel->Delete();
  • Chat->DeleteChannel()

    1Chat->DeleteChannel(FString ChannelID)
ParameterRequired in Channel->Delete()Required in Chat->DeleteChannel()Description
ChannelID
Type: FString
Default:
n/a
No
Yes
Unique channel identifier.

Output

TypeDescription
FPubnubChatOperationResult
Result of the operation. Check Error for failure.

Sample code

Reference code

This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code. Use it as a reference when working with other examples in this document.

Delete a channel asynchronously.

Actor.h
1

Actor.cpp
1

Delete channel from the Chat object

Last updated on