Channel Groups API for PubNub Unreal SDK

Channel groups allow PubNub developers to bundle thousands of channels into a group that can be identified by a name. These channel groups can then be subscribed to, receiving data from the many back-end channels the channel group contains.

Channel group operations

You can't publish to a channel group. You can only subscribe to it. To publish within the channel group, you need to publish to each channel individually.

icon

Usage in Blueprints and C++

Add Channels

Requires Stream Controller add-on

This method requires that the Stream Controller add-on is enabled for your key in the Admin Portal. Read the support page on enabling add-on features on your keys.

This function adds a channel to a channel group.

Method(s)

Adding Channels is accomplished by using the following method(s) in the Unreal SDK:

Maximum number of channels

200 channels can be added to the channel group per API call.

Basic Usage

#include "Kismet/GameplayStatics.h"
#include "PubnubSubsystem.h"

UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
UPubnubSubsystem* PubnubSubsystem = GameInstance->GetSubsystem<UPubnubSubsystem>();

FString ChannelName = "randomChannel";
FString ChanelGroup = "myChannelGroup";

// Add channel to channel group
PubnubSubsystem->AddChannelToGroup(ChannelName, ChannelGroup);

Returns

This method doesn't have any return value.

List Channels

Requires Stream Controller add-on

This method requires that the Stream Controller add-on is enabled for your key in the Admin Portal. Read the support page on enabling add-on features on your keys.

This function lists all the channels of the channel group.

Method(s)

Basic Usage

#include "Kismet/GameplayStatics.h"
#include "PubnubSubsystem.h"

UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
UPubnubSubsystem* PubnubSubsystem = GameInstance->GetSubsystem<UPubnubSubsystem>();

FString ChannelName = "randomChannel";
FString ChannelGroup = "myChannelGroup";

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

// Add channel to channel group
show all 16 lines

Returns

{
"error":false,
"payload":{
"channels":[],
"group":"my_channel"
},
"service":"channel-registry",
"status":200
}

Remove Channels

Requires Stream Controller add-on

This method requires that the Stream Controller add-on is enabled for your key in the Admin Portal. Read the support page on enabling add-on features on your keys.

This function removes the channels from the channel group.

Method(s)

Basic Usage

#include "Kismet/GameplayStatics.h"
#include "PubnubSubsystem.h"

UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
UPubnubSubsystem* PubnubSubsystem = GameInstance->GetSubsystem<UPubnubSubsystem>();

FString ChannelName = "randomChannel";
FString ChanelGroup = "myChannelGroup";

// Remove channel from channel group
PubnubSubsystem->RemoveChannelFromGroup(ChannelName, ChannelGroup);

Returns

This method doesn't have any return value.

Delete Channel Group

Requires Stream Controller add-on

This method requires that the Stream Controller add-on is enabled for your key in the Admin Portal. Read the support page on enabling add-on features on your keys.

This function removes the channel group.

Method(s)

Basic Usage

#include "Kismet/GameplayStatics.h"
#include "PubnubSubsystem.h"

UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
UPubnubSubsystem* PubnubSubsystem = GameInstance->GetSubsystem<UPubnubSubsystem>();

FString ChanelGroup = "myChannelGroup";

// Remove channel group
PubnubSubsystem->RemoveChannelGroup(ChannelGroup);

Returns

This method doesn't have any return value.

Last updated on