Leave channels

Use the Leave() method to remove user's channel membership and unsubscribe them from receiving messages and events.

icon

Usage in Blueprints and C++


Requires App Context

To set up and manage channel membership, you must enable App Context for your app's keyset in the Admin Portal.

Method signature

Output

This method doesn't return any value.

Basic usage

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

// Create a pubnub response delegate
// you MUST implement your own callback function to handle the response
FOnPubnubChannelMessageReceived MessageCallback;
MessageCallback.BindDynamic(this, &AMyActor::OnMessageReceived);

show all 18 lines
Last updated on