On this page

Get channel details

Fetch a specific channel's metadata with GetChannel().

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.

    1Chat->GetChannelAsync("support", OnGetChannelResponseDelegate);

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

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

    1FPubnubChatChannelResult Result = Chat->GetChannel("support");

Get channel

Method signature

1Chat->GetChannel(FString ChannelID)
* required
ParameterDescription
ChannelID *
Type: FString
Default:
n/a
Unique channel identifier (up to 92 UTF-8 byte sequences).

Output

ParameterDescription
FPubnubChatChannelResult
Type: struct
Returned object containing Result and Channel.
 → Result
Type: FPubnubChatOperationResult
Operation result with Error (bool) and ErrorMessage (FString).
 → Channel
Type: UPubnubChatChannel*
The requested channel object, or nullptr if the channel doesn't exist.

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.

Fetch a channel by ID asynchronously.

Actor.h
1

Actor.cpp
1

Get channel ID

GetChannelID is a getter method that returns the channel's ID.

Method signature

1Channel->GetChannelID();

Output

TypeDescription
FString
Returned channel ID.

Sample code

Return the ID of the channel support.

1

Get channel data

GetChannelData is a getter method that returns the channel's data.

Method signature

1Channel->GetChannelData();

Output

TypeDescription
FPubnubChatChannelData
Returned channel data.

Sample code

Return channel data from the support channel.

1

Last updated on