Channel Groups API for Windows C SDK (legacy)
New SDK available
The Windows C SDK is built on C-Core (legacy), which is still supported. If you are starting a new project, use the new C 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.
Channel Group operations
You can't publish to a Channel Group. You can only subscribe to it. To publish within Channel Group, you need to publish to each channel individually.
Add channels to a 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. See Enable the features your app calls.
This function adds channels to a channel group.
Method(s)
Adding Channels is accomplished by using the following method(s) in the Windows C SDK:
1enum pubnub_res pubnub_add_channel_to_group (pubnub_t *p, char const *channel, char const *channel_group)
Sample code
Add channels
1static char *channel_group = "family";
1enum pubnub_res res;
2res = pubnub_add_channel_to_group(pn, "wife", channel_group);
3return check_response(pn, res);
Rest response from server
1{
2 "service" : "channel-registry",
3 "status" : 200,
4 "error" : false,
5 "message" : "OK"
6}
List channels in a 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. See Enable the features your app calls.
This function lists all channels in a channel group.
Method(s)
Listing Channels is accomplished by using the following method(s) in the Windows C SDK:
1enum pubnub_res pubnub_list_channel_group (pubnub_t *p, char const *channel_group)
Sample code
List channels
1static char *channel_group = "family";
1pubnub_list_channel_group(ctx, channel_group);
2pbresult = pubnub_await(ctx);
3if (PNR_OK == pbresult) {
4 char const *json_response = pubnub_get(ctx);
5}
Rest response from server
1{
2 "status" : 200,
3 "payload" : {
4 "channels" : ["hi"],
5 "group" : "abcd"
6 },
7 "service" : "channel-registry",
8 "error" : False
9}
Remove channels from a 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. See Enable the features your app calls.
This function removes channels from the channel group.
Method(s)
Removing Channels is accomplished by using the following method(s) in the Windows C SDK:
1enum pubnub_res pubnub_remove_channel_from_group (pubnub_t *p, char const *channel, char const *channel_group)
Sample code
Remove channels
1static char *channel_group = "family";
1enum pubnub_res res;
2res = pubnub_remove_channel_from_group(pn, "son", channel_group);
3return check_response(pn, res);
Rest response from server
1{
2 "status" : 200,
3 "message" : "OK",
4 "service" : "channel-registry",
5 "error" : False
6}
Delete a 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. See Enable the features your app calls.
This function removes the channel group.
Method(s)
Deleting Channel Group is accomplished by using the following method(s) in the Windows C SDK:
1enum pubnub_res pubnub_remove_channel_group (pubnub_t *p, char const *channel_group)
Sample code
Delete channel group
1static char *channel_group = "family";
1enum pubnub_res res;
2res = pubnub_remove_channel_group(pn, channel_group);
3return check_response(pn, res);
Rest response from server
1{
2 "status" : 200,
3 "message" : "OK",
4 "service" : "channel-registry",
5 "error" : False
6}