Skip to main content

Subscribe to Channel

Enter (subscribe to) a specific channel.

Method Information

ItemContent
MethodAChatManager::GetInstance()->Subscribe(const FString& Channel, int32 PrevMessageCount = 0)
CallbackOnSubscribed(const FChatUserInfo& User) - Called when user enters

Parameters

ParameterTypeDescription
ChannelFStringChannel name to subscribe to
PrevMessageCountint32Number of previous chat messages to fetch (default: 0)

Code Example

void UMyGame::EnterChannel(const FString& ChannelName)
{
// Fetch previous 10 chat messages
AChatManager::GetInstance()->Subscribe(ChannelName, 10);
}

void UMyGame::OnSubscribed(const FChatUserInfo& User)
{
UE_LOG(LogTemp, Log, TEXT("%s entered"), *User.visitorName);
}