Get channel details
Unreal Chat SDK has several methods that allow you to get different channel-related data.
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
- Blueprint
- C++ / Input parameters
Chat->GetChannel(FString ChannelID)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
ChannelID | FString | Yes | n/a | Unique channel identifier (up to 92 UTF-8 byte sequences). |
Output
Type | Description |
---|---|
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
- Blueprint
- C++ / Input parameters
Channel->GetChannelID();
Output
Type | Description |
---|---|
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
- Blueprint
- C++ / Input parameters
Channel->GetChannelData();
Output
Type | Description |
---|---|
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();