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.
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.
- Blueprint
- C++
PubnubSubsystem->AddChannelToGroup(
FString ChannelName,
FString ChannelGroup
);
Parameter | Type | Required | Description |
---|---|---|---|
ChannelName | FString | Yes | The channel to add to the channel group. |
ChannelGroup | FString | Yes | The channel group to add the channels to. |
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)
- Blueprint
- C++
PubnubSubsystem->ListChannelsFromGroup(
FString ChannelGroup,
FOnPubnubResponse OnListChannelsResponse
);
Parameter | Type | Required | Description |
---|---|---|---|
ChannelGroup | FString | Yes | The channel group to list the channels of. |
OnListChannelsResponse | FOnPubnubResponse | Yes | The callback function used to handle the result. |
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 linesReturns
{
"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)
- Blueprint
- C++
PubnubSubsystem->RemoveChannelFromGroup(
FString ChannelName,
FString ChannelGroup
);
Parameter | Type | Required | Description |
---|---|---|---|
ChannelGroup | FString | Yes | The channel group to remove the channel from. |
ChannelName | FString | Yes | The channel to remove from the channel group. |
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)
- Blueprint
- C++
PubnubSubsystem->RemoveChannelGroup(
String ChannelGroup
);
Parameter | Type | Required | Description |
---|---|---|---|
ChannelGroup | FString | Yes | The channel group to remove. |
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.