Get channel details

Unreal Chat SDK has several methods that allow you to get different channel-related data.

icon

Usage in Blueprints and C++


Requires App Context

To store data about channels, you must enable App Context for your app's keyset in the Admin Portal.

Get channel

Fetch details of a specific channel using the GetChannel() method.

Method signature

Output

TypeDescription
UPubnubChannel*Object returning either the new channel metadata or null value if the channel doesn't exist.

Basic usage

Fetch the support channel metadata.

#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");

Get channel ID

GetChannelID is a getter method that returns the current chat user's ID.

Method signature

Output

TypeDescription
FString*Returned channel ID.

Basic usage

Return the ID of the channel support.

#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");

FString ChannelID = Channel->GetChannelID();

Get channel data

GetChannelData is a getter method that returns the current chat user's data.

Method signature

Output

TypeDescription
FPubnubChatChannelData*Returned channel data.

Basic usage

Return channel data from the support channel.

#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");

FPubnubChatChannelData* ChannelData = Channel->GetChannelData();
Last updated on