NativeNativeTwistedTornadoAsyncioPythonPython V4 Channel Groups API Reference for Realtime Apps

Go to Access Manager


 

These docs are for PubNub 4.0 for Python V4 which is our latest and greatest! For the docs of the older versions of the SDK, please check PubNub 3.0 for Python, PubNub 3.0 for Python-Tornado and PubNub 3.0 for Python-Twisted.

If you have questions about the PubNub for Python SDK, please contact us at support@pubnub.com.

Requires Stream Controller add-on XRequires that the Stream Controller add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
This function adds a channel to a channel group.
Adding Channels is accomplished by using the following method(s) in the Python V4 SDK:
 

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

  1. ParameterTypeRequiredDescription
    channelsString | List | TupleYesThe channel to add to the channel_group.
    channel_groupStringYesThe channel_group to add the channels to.
pubnub.add_channel_to_channel_group().\
    channels(["ch1", "ch2"]).\
    channel_group("cg1").\
    sync()
Requires Stream Controller add-on XRequires that the Stream Controller add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
This function lists all the channels of the channel group.
Listing Channels is accomplished by using the following method(s) in the Python V4 SDK:
  1. ParameterTypeRequiredDescription
    channel_groupStringYesThe channel group to fetch channels.
pubnub.list_channels_in_channel_group().\
    channel_group("cg1").sync()
Requires Stream Controller add-on XRequires that the Stream Controller add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
This function removes the channels from the channel group.
Removing Channels is accomplished by using the following method(s) in the Python V4 SDK:
  1. ParameterTypeRequiredDescription
    channelsString | List | TupleYesThe channels to remove from the channel group.
    channel_groupStringYesSpecifies channel_group to remove the channels from.
pubnub.remove_channel_from_channel_group().\
    channels(["son", "daughter"]).\
    channel_group("channel_group").\
    sync()
Requires Stream Controller add-on XRequires that the Stream Controller add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
This function removes the channel group.
Deleting Channel Group is accomplished by using the following method(s) in the Python V4 SDK:
  1. ParameterTypeRequiredDescription
    channel_groupStringYesThe channel group to remove.
pubnub.remove_channel_group().\
    channel_group("cg1").sync()

Go to Storage and Playback