Get channel details
Fetch a specific channel's metadata with GetChannel().
Requires App Context
Enable App Context for your keyset in the Admin Portal.
Asynchronous and synchronous method execution
Most PubNub Unreal SDK methods are available in both asynchronous and synchronous variants.
-
Asynchronous methods (
Asyncsuffix) returnvoidand 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
Nativesuffix (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
- C++ / Input parameters
- Blueprint
1Chat->GetChannel(FString ChannelID)
| Parameter | Description |
|---|---|
ChannelID *Type: FStringDefault: n/a | Unique channel identifier (up to 92 UTF-8 byte sequences). |
Output
| Parameter | Description |
|---|---|
FPubnubChatChannelResultType: struct | Returned object containing Result and Channel. |
→ ResultType: FPubnubChatOperationResult | Operation result with Error (bool) and ErrorMessage (FString). |
→ ChannelType: 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.
Get channel ID
GetChannelID is a getter method that returns the channel's ID.
Method signature
- C++ / Input parameters
- Blueprint
1Channel->GetChannelID();
Output
| Type | Description |
|---|---|
FString | Returned channel ID. |
Sample code
Return the ID of the channel support.
- C++
- Blueprint
1
Get channel data
GetChannelData is a getter method that returns the channel's data.
Method signature
- C++ / Input parameters
- Blueprint
1Channel->GetChannelData();
Output
| Type | Description |
|---|---|
FPubnubChatChannelData | Returned channel data. |
Sample code
Return channel data from the support channel.
- C++
- Blueprint
1