Channel Groups API for 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 to a channel group - ChannelGroup entity
Requires Stream Controller add-on
This method requires the Stream Controller add-on enabled for your key in the Admin Portal. Read the support page on enabling add-on features.
This function adds a channel to a channel group.
Method(s)
Maximum number of channels
You can add up to 200 channels to a channel group per API call.
1UPubnubChannelGroupEntity* ChannelGroupEntity = PubnubSubsystem->CreateChannelGroupEntity("my-channel-group");
2
3ChannelGroupEntity->AddChannelToGroup(
4 FString Channel,
5 FOnAddChannelToGroupResponse OnAddChannelToGroupResponse
6);
| Parameter | Description |
|---|---|
Channel *Type: FString | The channel to add to the channel group. |
OnAddChannelToGroupResponse * | The delegate for the operation's result. You can also use a native callback of the type FOnAddChannelToGroupResponseNative to handle the result using a lambda. |
FOnAddChannelToGroupResponse
| Field | Type | Description |
|---|---|---|
Result | FPubnubOperationResult | The operation result. |
FOnAddChannelToGroupResponseNative
| Field | Type | Description |
|---|---|---|
Result | const FPubnubOperationResult& | The operation result. |
Sample code
Reference code
ACTION REQUIRED before running the code.- C++
Requires Stream Controller add-on
This method requires the Stream Controller add-on enabled for your key in the Admin Portal. Read the support page on enabling add-on features.
This function lists all channels in the channel group.
Method(s)
1UPubnubChannelGroupEntity* ChannelGroupEntity = PubnubSubsystem->CreateChannelGroupEntity("my-channel-group");
2
3ChannelGroupEntity->ListChannelsFromGroup(
4 FOnListChannelsFromGroupResponse OnListChannelsResponse
5);
| Parameter | Description |
|---|---|
OnListChannelsResponse * | The operation result delegate. You can also use FOnListChannelsFromGroupResponseNative with a lambda. |
FOnListChannelsFromGroupResponse
| Field | Type | Description |
|---|---|---|
Result | FPubnubOperationResult | The operation result. |
Channels | TArray<FString>& | Channel names in the group. |
FOnListChannelsFromGroupResponseNative
| Field | Type | Description |
|---|---|---|
Result | const FPubnubOperationResult& | The operation result. |
Channels | const TArray<FString>& | Channel names in the group. |
Sample code
Reference code
ACTION REQUIRED before running the code.- C++
Requires Stream Controller add-on
This method requires the Stream Controller add-on enabled for your key in the Admin Portal. Read the support page on enabling add-on features.
This function removes channels from the channel group.
Method(s)
1UPubnubChannelGroupEntity* ChannelGroupEntity = PubnubSubsystem->CreateChannelGroupEntity("my-channel-group");
2
3ChannelGroupEntity->RemoveChannelFromGroup(
4 FString Channel,
5 FOnRemoveChannelFromGroupResponse OnRemoveChannelFromGroupResponse
6);
| Parameter | Description |
|---|---|
Channel *Type: FString | The channel to remove from the channel group. |
OnRemoveChannelFromGroupResponse * | The operation result delegate. You can also use FOnRemoveChannelFromGroupResponseNative with a lambda. |
FOnRemoveChannelFromGroupResponse
| Field | Type | Description |
|---|---|---|
Result | FPubnubOperationResult | The operation result. |
FOnRemoveChannelFromGroupResponseNative
| Field | Type | Description |
|---|---|---|
Result | const FPubnubOperationResult& | The operation result. |
Sample code
Reference code
ACTION REQUIRED before running the code.- C++
Requires Stream Controller add-on
This method requires the Stream Controller add-on enabled for your key in the Admin Portal. Read the support page on enabling add-on features.
This function removes a channel group.
Method(s)
1UPubnubChannelGroupEntity* ChannelGroupEntity = PubnubSubsystem->CreateChannelGroupEntity("my-channel-group");
2
3ChannelGroupEntity->RemoveChannelGroup(
4 FOnRemoveChannelGroupResponse OnRemoveChannelGroupResponse
5);
| Parameter | Description |
|---|---|
OnRemoveChannelGroupResponse * | The operation result delegate. You can also use FOnRemoveChannelGroupResponseNative with a lambda. |
FOnRemoveChannelGroupResponse
| Field | Type | Description |
|---|---|---|
Result | FPubnubOperationResult | The operation result. |
FOnRemoveChannelGroupResponseNative
| Field | Type | Description |
|---|---|---|
Result | const FPubnubOperationResult& | The operation result. |
Sample code
Reference code
ACTION REQUIRED before running the code.- C++
- Add channels to a channel group - ChannelGroup entity
- Add channels to a channel group - PubNub client
- List channels in a channel group - ChannelGroup entity
- List channels in a channel group - PubNub client
- Remove channels from a channel group - ChannelGroup entity
- Remove channels from a channel group - PubNub client
- Delete a channel group - ChannelGroup entity
- Delete a channel group - PubNub client
- Complete example