TwistedTwistedTornadoAsyncioNativePythonPython-Twisted V4 Channel Groups API Reference for Realtime Apps

Go to Access Manager


 

NOTICE: Based on current web trends and our own usage data, PubNub's Python Twisted SDK is deprecated as of May 1, 2019. Deprecation means we will no longer be updating the Python Twisted SDK but will continue to support users currently using it. Please feel free to use our other Python SDK offerings as they will continue to be supported and maintained. If you would like to use the Python Twisted SDK specifically, we would love to work with you on keeping this project alive!

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-Twisted 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.
d = pubnub.add_channel_to_channel_group().\
    channels(["ch1", "ch2"]).\
    channel_group("cg1").\
    deferred()

d.addCallback(my_callback)
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-Twisted V4 SDK:
  1. ParameterTypeRequiredDescription
    channel_groupStringYesThe channel group to fetch channels.
envelope = yield pubnub.list_channels_in_channel_group().\
    channel_group("cg1").future()
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-Twisted V4 SDK:
  1. ParameterTypeRequiredDescription
    channelsString | List | TupleYesThe channels to remove from the channel group.
    channel_groupStringYesSpecifies channel_group to remove the channels from.
# if we're using inlineCallbacks
envelope = yield pubnub.remove_channel_from_channel_group()\
    .group(channel_group)\
    .channels(["son", "daughter"])\
    .deferred()

# if we're not using inlineCallbacks
d = pubnub.remove_channel_from_channel_group()\
    .group(channel_group)\
    .channels(["son", "daughter"])\
    .deferred()

d.addCallback(my_callback)
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-Twisted V4 SDK:
  1. ParameterTypeRequiredDescription
    channel_groupStringYesThe channel group to remove.
# if we're using inlineCallbacks
envelope = yield pubnub.remove_channel_group()\
    .group(channel_group)\
    .deferred()

# if we're not using inlineCallbacks
d = pubnub.remove_channel_group()\
    .group(channel_group)\
    .deferred()

d.addCallback(my_callback)

Go to Storage and Playback