Welcome to PubNub’s documentation!¶
@@ -50,14 +50,14 @@Pubnub¶
-
-
- -class Pubnub.Pubnub(publish_key, subscribe_key, secret_key=None, cipher_key=None, auth_key=None, ssl_on=False, origin='pubsub.pubnub.com', uuid=None, pooling=True, daemon=False, pres_uuid=None, azure=False)¶ +
-
+class
pubnub.Pubnub(publish_key, subscribe_key, secret_key=None, cipher_key=None, auth_key=None, ssl_on=False, origin='pubsub.pubnub.com', uuid=None, pooling=True, daemon=False, pres_uuid=None, azure=False)¶ -
-
- -audit(channel=None, channel_group=None, auth_key=None, callback=None, error=None)¶ +
-
+
audit(channel=None, channel_group=None, auth_key=None, callback=None, error=None)¶ Method for fetching permissions from pubnub servers.
This method provides a mechanism to reveal existing PubNub Access Manager attributes for any combination of subscribe_key, channel and auth_key.
@@ -95,28 +95,21 @@ Required argument when working with twisted or tornado .- Returns:
Returns a dict in sync mode i.e. when callback argument is not given The dict returned contains values with keys ‘message’ and ‘payload’
-Sample Response -{
--
-“message”:”Success”, -“payload”:{
--
--
-
- “channels”:{ -
-
-
- “my_channel”:{ -
- “auths”:{“my_ro_authkey”:{“r”:1,”w”:0}, -“my_rw_authkey”:{“r”:0,”w”:1}, -“my_admin_authkey”:{“r”:1,”w”:1} -
}
-
-
}
-},
-}
+Sample Response:
++{ + "message":"Success", + "payload":{ + "channels":{ + "my_channel":{ + "auths":{"my_ro_authkey":{"r":1,"w":0}, + "my_rw_authkey":{"r":0,"w":1}, + "my_admin_authkey":{"r":1,"w":1} + } + } + }, +} +
Usage:
@@ -125,8 +118,8 @@ The dict returned contains values with keys ‘message’ and ‘pay
-
-
- -channel_group_list_channels(channel_group, callback=None, error=None)¶ +
-
+
channel_group_list_channels(channel_group, callback=None, error=None)¶ Get list of channels for a group.
Using this method, list of channels for a group, can be obtained.
-
@@ -149,43 +142,43 @@ Required argument when working with twisted or tornado.
- Returns:
Sync Mode: dict channel_group_list_channels method returns a dict which contains list of channels -in payload field -{
--
-u’status’: 200, -u’payload’: {“channels”: [“hi”], “group”: “abcd”}, -u’service’: u’channel-registry’, -u’error’: False}
+in payload field: ++{ + u'status': 200, + u'payload': {"channels": ["hi"], "group": "abcd"}, + u'service': u'channel-registry', + u'error': False +} +
Async Mode: None ( callback gets the response as parameter )
Response Format:
The callback passed to channel_group_list_channels gets the a dict containing list of channels -under payload field
--
-
- { -
- u’payload’: {“channels”: [“hi”], “group”: “abcd”} -
}
+under payload field: ++{ + u'payload': {"channels": ["hi"], "group": "abcd"} +} +
-
-
- -channel_group_list_groups(namespace=None, callback=None, error=None)¶ +
-
+
channel_group_list_groups(namespace=None, callback=None, error=None)¶ Get list of groups.
Using this method, list of groups for the subscribe key associated with PubNub object, can be obtained. If namespace is provided, groups within the namespace only are listed
- Args: -
namespace: (string) (optional) namespace -callback: (optional)
--
+A callback method should be passed to the method. -If set, the api works in async mode. -Required argument when working with twisted or tornado .namespace: (string) (optional) namespace
-
+
- callback: (optional) +
- A callback method should be passed to the method. +If set, the api works in async mode. +Required argument when working with twisted or tornado .
- error: (optional)
- Optional variable. An error method can be passed to the method. If set, the api works in async mode. @@ -193,32 +186,33 @@ Required argument when working with twisted or tornado .
- Returns: -
Sync Mode: dict -channel_group_list_groups method returns a dict which contains list of groups -in payload field -{
--
-u’status’: 200, -u’payload’: {“namespace”: “dev”, “groups”: [“abcd”]}, -u’service’: u’channel-registry’, -u’error’: False}
+Sync Mode: dict
+channel_group_list_groups method returns a dict which contains list of groups +in payload field:
++{ + u'status': 200, + u'payload': {"namespace": "dev", "groups": ["abcd"]}, + u'service': u'channel-registry', + u'error': False +} +
Async Mode: None ( callback gets the response as parameter )
Response Format:
The callback passed to channel_group_list_namespaces gets the a dict containing list of groups -under payload field
--
-
- { -
- u’payload’: {“namespace”: “dev”, “groups”: [“abcd”]} -
}
+under payload field: ++{ + u'payload': {"namespace": "dev", "groups": ["abcd"]} +} +
-
-
- -channel_group_list_namespaces(callback=None, error=None)¶ +
-
+
channel_group_list_namespaces(callback=None, error=None)¶ Get list of namespaces.
You can obtain list of namespaces for the subscribe key associated with PubNub object using this method.
@@ -236,44 +230,40 @@ Required argument when working with twisted or tornado.
Sync Mode: dict -channel_group_list_namespaces method returns a dict which contains list of namespaces -in payload field -{
---u’status’: 200, -u’payload’: {
---u’sub_key’: u’demo’, -u’namespaces’: [u’dev’, u’foo’]}, -u’service’: u’channel-registry’, -u’error’: False
-
}
+Sync Mode: dict
+channel_group_list_namespaces method returns a dict which contains list of namespaces +in payload field:
+{
+ u'status': 200,
+ u'payload': {
+ u'sub_key': u'demo',
+ u'namespaces': [u'dev', u'foo']
+ },
+ u'service': u'channel-registry',
+ u'error': False
+}
+Async Mode: None (callback gets the response as parameter)
Response Format:
The callback passed to channel_group_list_namespaces gets the a dict containing list of namespaces -under payload field
--
-
- { -
-
-
- u’payload’: { -
- u’sub_key’: u’demo’, -u’namespaces’: [u’dev’, u’foo’] -
}
-
-
}
+under payload field: +{
+ u'payload': {
+ u'sub_key': u'demo',
+ u'namespaces': [u'dev', u'foo']
+ }
+}
+namespaces is the list of namespaces for the given subscribe key
-
-
- -channel_group_remove_channel(channel_group, channel, callback=None, error=None)¶ +
-
+
channel_group_remove_channel(channel_group, channel, callback=None, error=None)¶ Remove channel.
A channel can be removed from a group method.
-
@@ -297,34 +287,36 @@ Required argument when working with twisted or tornado .
Sync Mode: dict -channel_group_remove_channel method returns a dict indicating status of the request
--
-
- { -
- u’status’: 200, -u’message’: ‘OK’, -u’service’: u’channel-registry’, -u’error’: False -
}
+Sync Mode: dict
+channel_group_remove_channel method returns a dict indicating +status of the request:
+{
+ u'status': 200,
+ u'message': 'OK',
+ u'service': u'channel-registry',
+ u'error': False
+}
+Async Mode: None ( callback gets the response as parameter )
Response Format:
-The callback passed to channel_group_remove_channel gets the a dict indicating status of the request
--
-
- { -
- u’status’: 200, -u’message’: ‘OK’, -u’service’: u’channel-registry’, -u’error’: False -
}
+The callback passed to channel_group_remove_channel gets the a dict +indicating status of the request:
+{
+ u'status': 200,
+ u'message': 'OK',
+ u'service': u'channel-registry',
+ u'error': False
+}
+-
-
- -channel_group_remove_group(channel_group, callback=None, error=None)¶ +
-
+
channel_group_remove_group(channel_group, callback=None, error=None)¶ Remove channel group.
A channel group can be removed using this method.
-
@@ -345,45 +337,46 @@ Required argument when working with twisted or tornado.
Sync Mode: dict -channel_group_remove_group method returns a dict indicating status of the request
--
-
- { -
- u’status’: 200, -u’message’: ‘OK’, -u’service’: u’channel-registry’, -u’error’: False -
}
+Sync Mode: dict
+channel_group_remove_group method returns a dict indicating status +of the request:
+{
+ u'status': 200,
+ u'message': 'OK',
+ u'service': u'channel-registry',
+ u'error': False
+}
+Async Mode: None ( callback gets the response as parameter )
Response Format:
-The callback passed to channel_group_remove_group gets the a dict indicating status of the request
--
-
- { -
- u’status’: 200, -u’message’: ‘OK’, -u’service’: u’channel-registry’, -u’error’: False -
}
+The callback passed to channel_group_remove_group gets the a dict +indicating status of the request:
+{
+ u'status': 200,
+ u'message': 'OK',
+ u'service': u'channel-registry',
+ u'error': False
+}
+-
-
- -channel_group_remove_namespace(namespace, callback=None, error=None)¶ +
-
+
channel_group_remove_namespace(namespace, callback=None, error=None)¶ Remove a namespace.
A namespace can be deleted using this method.
- Args: -
namespace: (string) namespace to be deleted -callback: (optional)
--
+A callback method should be passed to the method. -If set, the api works in async mode. -Required argument when working with twisted or tornado .namespace: (string) namespace to be deleted
-
+
- callback: (optional) +
- A callback method should be passed to the method. +If set, the api works in async mode. +Required argument when working with twisted or tornado .
- error: (optional)
- Optional variable. An error method can be passed to the method. If set, the api works in async mode. @@ -391,34 +384,36 @@ Required argument when working with twisted or tornado .
- Returns: -
Sync Mode: dict -channel_group_remove_namespace method returns a dict indicating status of the request
--
-
- { -
- u’status’: 200, -u’message’: ‘OK’, -u’service’: u’channel-registry’, -u’error’: False -
}
+Sync Mode: dict
+channel_group_remove_namespace method returns a dict indicating +status of the request:
++{ + u'status': 200, + u'message': 'OK', + u'service': u'channel-registry', + u'error': False +} +
Async Mode: None ( callback gets the response as parameter )
Response Format:
-The callback passed to channel_group_list_namespaces gets the a dict indicating status of the request
--
-
- { -
- u’status’: 200, -u’message’: ‘OK’, -u’service’: u’channel-registry’, -u’error’: False -
}
+The callback passed to channel_group_list_namespaces gets the a +dict indicating status of the request:
++{ + u'status': 200, + u'message': 'OK', + u'service': u'channel-registry', + u'error': False +} +
-
-
- -decrypt(message)¶ +
-
+
decrypt(message)¶ Method for decrypting data.
This method takes ciphertext as input and returns decrypted data. This need not be called directly as enncryption/decryption is @@ -433,8 +428,8 @@ provided at time of initializing pubnub object
-
-
- -encrypt(message)¶ +
-
+
encrypt(message)¶ Method for encrypting data.
This method takes plaintext as input and returns encrypted data. This need not be called directly as enncryption/decryption is @@ -449,8 +444,8 @@ provided at time of initializing pubnub object
-
-
- -grant(channel=None, channel_group=None, auth_key=False, read=False, write=False, manage=False, ttl=5, callback=None, error=None)¶ +
-
+
grant(channel=None, channel_group=None, auth_key=False, read=False, write=False, manage=False, ttl=5, callback=None, error=None)¶ Method for granting permissions.
This function establishes subscribe and/or write permissions for PubNub Access Manager (PAM) by setting the read or write attribute @@ -493,7 +488,7 @@ Read permissions are removed by setting to False.
- write: (boolean) (default: True)
- Write permissions are granted by setting to true. Write permissions are removed by setting to false. -
- manage: (boolean) (default: True) +
- manage: (boolean) (default: True)
- Manage permissions are granted by setting to true. Manage permissions are removed by setting to false.
- ttl: (int) (default: 1440 i.e 24 hrs) @@ -513,31 +508,28 @@ Required argument when working with twisted or tornado .
- Returns:
Returns a dict in sync mode i.e. when callback argument is not given The dict returned contains values with keys ‘message’ and ‘payload’
-Sample Response: -{
--
-“message”:”Success”, -“payload”:{
--
-“ttl”:5, -“auths”:{
--
-“my_ro_authkey”:{“r”:1,”w”:0}}, -“subscribe_key”:”my_subkey”, -“level”:”user”, -“channel”:”my_channel”
-}
-}
+Sample Response:
++{ + "message":"Success", + "payload":{ + "ttl":5, + "auths":{ + "my_ro_authkey":{"r":1,"w":0} + }, + "subscribe_key":"my_subkey", + "level":"user", + "channel":"my_channel" + } +} +
-
-
- -here_now(channel, callback=None, error=None)¶ +
-
+
here_now(channel, uuids=True, state=False, callback=None, error=None)¶ Get here now data.
You can obtain information about the current state of a channel including a list of unique user-ids currently subscribed to the channel and the total @@ -566,26 +558,25 @@ Async Mode: None
The here_now() method returns a list of uuid s currently subscribed to the channel.
uuids:[“String”,”String”, ... ,”String”] - List of UUIDs currently subscribed to the channel.
occupancy: Number - Total current occupancy of the channel.
-Example Response: -{
--
-occupancy: 4, -uuids: [
--
-‘123123234t234f34fq3dq’, -‘143r34f34t34fq34q34q3’, -‘23f34d3f4rq34r34rq23q’, -‘w34tcw45t45tcw435tww3’,]
-}
+Example Response:
++{ + occupancy: 4, + uuids: [ + '123123234t234f34fq3dq', + '143r34f34t34fq34q34q3', + '23f34d3f4rq34r34rq23q', + 'w34tcw45t45tcw435tww3', + ] +} +
-
-
- -history(channel, count=100, reverse=False, start=None, end=None, callback=None, error=None)¶ +
-
+
history(channel, count=100, reverse=False, start=None, end=None, include_token=False, callback=None, error=None)¶ This method fetches historical messages of a channel.
PubNub Storage/Playback Service provides real-time access to an unlimited history for all messages published to PubNub. Stored messages are replicated @@ -629,19 +620,18 @@ Required argument when working with twisted or tornado .
-
-
- -presence(channel, callback, error=None)¶ +
-
+
presence(channel, callback, error=None, connect=None, disconnect=None, reconnect=None)¶ Subscribe to presence events on a channel.
Only works in async mode- Args: -
channel: Channel name ( string ) on which to listen for events -callback: A callback method should be passed as parameter.
--
+If passed, the api works in async mode. -Required argument when working with twisted or tornado .channel: Channel name ( string ) on which to listen for events
-
+
- callback: A callback method should be passed as parameter. +
- If passed, the api works in async mode. +Required argument when working with twisted or tornado .
- error: Optional variable. An error method can be passed as parameter.
- If set, the api works in async mode.
-
-
- -presence_group(channel_group, callback, error=None)¶ +
-
+
presence_group(channel_group, callback, error=None, connect=None, disconnect=None, reconnect=None)¶ Subscribe to presence events on a channel group.
Only works in async mode- Args: -
channel_group: Channel group name ( string ) -callback: A callback method should be passed to the method.
--
+If passed, the api works in async mode. -Required argument when working with twisted or tornado .channel_group: Channel group name ( string )
-
+
- callback: A callback method should be passed to the method. +
- If passed, the api works in async mode. +Required argument when working with twisted or tornado .
- error: Optional variable. An error method can be passed as parameter.
- If passed, the api works in async mode.
-
-
- -publish(channel, message, callback=None, error=None)¶ +
-
+
publish(channel, message, callback=None, error=None)¶ Publishes data on a channel.
The publish() method is used to send a message to all subscribers of a channel. To publish a message you must first specify a valid publish_key at initialization. A successfully published message is replicated across the PubNub Real-Time Network and sent simultaneously to all subscribed clients on a channel.
--
-Messages in transit can be secured from potential eavesdroppers with SSL/TLS bysetting ssl to True during initialization.
+Messages in transit can be secured from potential eavesdroppers with SSL/TLS by +setting ssl to True during initialization.
Published messages can also be encrypted with AES-256 simply by specifying a cipher_key during initialization.
-
@@ -718,8 +706,8 @@ Async Mode : None
-
-
- -revoke(channel=None, channel_group=None, auth_key=None, ttl=1, callback=None, error=None)¶ +
-
+
revoke(channel=None, channel_group=None, auth_key=None, ttl=1, callback=None, error=None)¶ Method for revoking permissions.
- Args: @@ -762,31 +750,28 @@ Required argument when working with twisted or tornado .
- Returns:
Returns a dict in sync mode i.e. when callback argument is not given The dict returned contains values with keys ‘message’ and ‘payload’
-Sample Response: -{
--
-“message”:”Success”, -“payload”:{
--
-“ttl”:5, -“auths”:{
--
-“my_authkey”:{“r”:0,”w”:0}}, -“subscribe_key”:”my_subkey”, -“level”:”user”, -“channel”:”my_channel”
-}
-}
+Sample Response:
++{ + "message":"Success", + "payload":{ + "ttl":5, + "auths":{ + "my_authkey":{"r":0,"w":0} + }, + "subscribe_key":"my_subkey", + "level":"user", + "channel":"my_channel" + } +} +
-
-
- -subscribe(channels, callback, error=None, connect=None, disconnect=None, reconnect=None, sync=False)¶ +
-
+
subscribe(channels, callback, state=None, error=None, connect=None, disconnect=None, reconnect=None, sync=False)¶ Subscribe to data on a channel.
This function causes the client to create an open TCP socket to the PubNub Real-Time Network and begin listening for messages on a specified channel. @@ -801,6 +786,8 @@ initialization.
multiple channels as a comma separated list or andarray.- callback: (function)
- This callback is called on receiving a message from the channel. +
- state: (dict) +
- State to be set.
- error: (function) (optional)
- This callback is called on an error event
- connect: (function) (optional) @@ -817,8 +804,8 @@ multiple channels as a comma separated list or andarray.
-
-
- -subscribe_group(channel_groups, callback, error=None, connect=None, disconnect=None, reconnect=None, sync=False)¶ +
-
+
subscribe_group(channel_groups, callback, error=None, connect=None, disconnect=None, reconnect=None, sync=False)¶ Subscribe to data on a channel group.
This function causes the client to create an open TCP socket to the PubNub Real-Time Network and begin listening for messages on a specified channel. @@ -849,8 +836,8 @@ multiple channel groups as a comma separated list or andarray.
-
-
- -time(callback=None)¶ +
-
+
time(callback=None)¶ This function will return a 17 digit precision Unix epoch.
Args:
@@ -873,8 +860,8 @@ Required argument when working with twisted or tornado .
-
-
- -unsubscribe(channel)¶ +
-
+
unsubscribe(channel)¶ - Unsubscribe from channel .
- Only works in async mode @@ -884,8 +871,8 @@ Required argument when working with twisted or tornado .
-
-
- -unsubscribe_group(channel_group)¶ +
-
+
unsubscribe_group(channel_group)¶ - Unsubscribe from channel group.
- Only works in async mode @@ -900,11 +887,11 @@ Required argument when working with twisted or tornado .
- -class Pubnub.PubnubTwisted(publish_key, subscribe_key, secret_key=None, cipher_key=None, auth_key=None, ssl_on=False, origin='pubsub.pubnub.com')¶ +
-
+class
pubnub.PubnubTwisted(publish_key, subscribe_key, secret_key=None, cipher_key=None, auth_key=None, ssl_on=False, origin='pubsub.pubnub.com')¶ -
-
- -audit(channel=None, channel_group=None, auth_key=None, callback=None, error=None)¶ +
-
+
audit(channel=None, channel_group=None, auth_key=None, callback=None, error=None)¶ Method for fetching permissions from pubnub servers.
This method provides a mechanism to reveal existing PubNub Access Manager attributes for any combination of subscribe_key, channel and auth_key.
@@ -942,28 +929,21 @@ Required argument when working with twisted or tornado .- Returns:
Returns a dict in sync mode i.e. when callback argument is not given The dict returned contains values with keys ‘message’ and ‘payload’
-Sample Response -{
--
-“message”:”Success”, -“payload”:{
--
--
-
- “channels”:{ -
-
-
- “my_channel”:{ -
- “auths”:{“my_ro_authkey”:{“r”:1,”w”:0}, -“my_rw_authkey”:{“r”:0,”w”:1}, -“my_admin_authkey”:{“r”:1,”w”:1} -
}
-
-
}
-},
-}
+Sample Response:
++{ + "message":"Success", + "payload":{ + "channels":{ + "my_channel":{ + "auths":{"my_ro_authkey":{"r":1,"w":0}, + "my_rw_authkey":{"r":0,"w":1}, + "my_admin_authkey":{"r":1,"w":1} + } + } + }, +} +
Usage:
@@ -972,8 +952,8 @@ The dict returned contains values with keys ‘message’ and ‘pay- -channel_group_list_channels(channel_group, callback=None, error=None)¶ +
-
+
channel_group_list_channels(channel_group, callback=None, error=None)¶ Get list of channels for a group.
Using this method, list of channels for a group, can be obtained.
-
@@ -996,43 +976,43 @@ Required argument when working with twisted or tornado.
- Returns:
Sync Mode: dict channel_group_list_channels method returns a dict which contains list of channels -in payload field -{
--
-u’status’: 200, -u’payload’: {“channels”: [“hi”], “group”: “abcd”}, -u’service’: u’channel-registry’, -u’error’: False}
+in payload field: ++{ + u'status': 200, + u'payload': {"channels": ["hi"], "group": "abcd"}, + u'service': u'channel-registry', + u'error': False +} +
Async Mode: None ( callback gets the response as parameter )
Response Format:
The callback passed to channel_group_list_channels gets the a dict containing list of channels -under payload field
--
-
- { -
- u’payload’: {“channels”: [“hi”], “group”: “abcd”} -
}
+under payload field: ++{ + u'payload': {"channels": ["hi"], "group": "abcd"} +} +
- -channel_group_list_groups(namespace=None, callback=None, error=None)¶ +
-
+
channel_group_list_groups(namespace=None, callback=None, error=None)¶ Get list of groups.
Using this method, list of groups for the subscribe key associated with PubNub object, can be obtained. If namespace is provided, groups within the namespace only are listed
- Args: -
namespace: (string) (optional) namespace -callback: (optional)
--
+A callback method should be passed to the method. -If set, the api works in async mode. -Required argument when working with twisted or tornado .namespace: (string) (optional) namespace
-
+
- callback: (optional) +
- A callback method should be passed to the method. +If set, the api works in async mode. +Required argument when working with twisted or tornado .
- error: (optional)
- Optional variable. An error method can be passed to the method. If set, the api works in async mode. @@ -1040,32 +1020,33 @@ Required argument when working with twisted or tornado .
- Returns: -
Sync Mode: dict -channel_group_list_groups method returns a dict which contains list of groups -in payload field -{
--
-u’status’: 200, -u’payload’: {“namespace”: “dev”, “groups”: [“abcd”]}, -u’service’: u’channel-registry’, -u’error’: False}
+Sync Mode: dict
+channel_group_list_groups method returns a dict which contains list of groups +in payload field:
++{ + u'status': 200, + u'payload': {"namespace": "dev", "groups": ["abcd"]}, + u'service': u'channel-registry', + u'error': False +} +
Async Mode: None ( callback gets the response as parameter )
Response Format:
The callback passed to channel_group_list_namespaces gets the a dict containing list of groups -under payload field
--
-
- { -
- u’payload’: {“namespace”: “dev”, “groups”: [“abcd”]} -
}
+under payload field: ++{ + u'payload': {"namespace": "dev", "groups": ["abcd"]} +} +
- -channel_group_list_namespaces(callback=None, error=None)¶ +
-
+
channel_group_list_namespaces(callback=None, error=None)¶ Get list of namespaces.
You can obtain list of namespaces for the subscribe key associated with PubNub object using this method.
@@ -1083,44 +1064,40 @@ Required argument when working with twisted or tornado.- Returns: -
Sync Mode: dict -channel_group_list_namespaces method returns a dict which contains list of namespaces -in payload field -{
--
-u’status’: 200, -u’payload’: {
--
-u’sub_key’: u’demo’, -u’namespaces’: [u’dev’, u’foo’]}, -u’service’: u’channel-registry’, -u’error’: False
-}
+Sync Mode: dict
+channel_group_list_namespaces method returns a dict which contains list of namespaces +in payload field:
++{ + u'status': 200, + u'payload': { + u'sub_key': u'demo', + u'namespaces': [u'dev', u'foo'] + }, + u'service': u'channel-registry', + u'error': False +} +
Async Mode: None (callback gets the response as parameter)
Response Format:
The callback passed to channel_group_list_namespaces gets the a dict containing list of namespaces -under payload field
--
-
- { -
-
-
- u’payload’: { -
- u’sub_key’: u’demo’, -u’namespaces’: [u’dev’, u’foo’] -
}
-
-
}
+under payload field: ++{ + u'payload': { + u'sub_key': u'demo', + u'namespaces': [u'dev', u'foo'] + } +} +
namespaces is the list of namespaces for the given subscribe key
- -channel_group_remove_channel(channel_group, channel, callback=None, error=None)¶ +
-
+
channel_group_remove_channel(channel_group, channel, callback=None, error=None)¶ Remove channel.
A channel can be removed from a group method.
-
@@ -1144,34 +1121,36 @@ Required argument when working with twisted or tornado .
- Returns: -
Sync Mode: dict -channel_group_remove_channel method returns a dict indicating status of the request
--
-
- { -
- u’status’: 200, -u’message’: ‘OK’, -u’service’: u’channel-registry’, -u’error’: False -
}
+Sync Mode: dict
+channel_group_remove_channel method returns a dict indicating +status of the request:
++{ + u'status': 200, + u'message': 'OK', + u'service': u'channel-registry', + u'error': False +} +
Async Mode: None ( callback gets the response as parameter )
Response Format:
-The callback passed to channel_group_remove_channel gets the a dict indicating status of the request
--
-
- { -
- u’status’: 200, -u’message’: ‘OK’, -u’service’: u’channel-registry’, -u’error’: False -
}
+The callback passed to channel_group_remove_channel gets the a dict +indicating status of the request:
++{ + u'status': 200, + u'message': 'OK', + u'service': u'channel-registry', + u'error': False +} +
- -channel_group_remove_group(channel_group, callback=None, error=None)¶ +
-
+
channel_group_remove_group(channel_group, callback=None, error=None)¶ Remove channel group.
A channel group can be removed using this method.
-
@@ -1192,45 +1171,46 @@ Required argument when working with twisted or tornado.
- Returns: -
Sync Mode: dict -channel_group_remove_group method returns a dict indicating status of the request
--
-
- { -
- u’status’: 200, -u’message’: ‘OK’, -u’service’: u’channel-registry’, -u’error’: False -
}
+Sync Mode: dict
+channel_group_remove_group method returns a dict indicating status +of the request:
++{ + u'status': 200, + u'message': 'OK', + u'service': u'channel-registry', + u'error': False +} +
Async Mode: None ( callback gets the response as parameter )
Response Format:
-The callback passed to channel_group_remove_group gets the a dict indicating status of the request
--
-
- { -
- u’status’: 200, -u’message’: ‘OK’, -u’service’: u’channel-registry’, -u’error’: False -
}
+The callback passed to channel_group_remove_group gets the a dict +indicating status of the request:
++{ + u'status': 200, + u'message': 'OK', + u'service': u'channel-registry', + u'error': False +} +
- -channel_group_remove_namespace(namespace, callback=None, error=None)¶ +
-
+
channel_group_remove_namespace(namespace, callback=None, error=None)¶ Remove a namespace.
A namespace can be deleted using this method.
- Args: -
namespace: (string) namespace to be deleted -callback: (optional)
--
+A callback method should be passed to the method. -If set, the api works in async mode. -Required argument when working with twisted or tornado .namespace: (string) namespace to be deleted
-
+
- callback: (optional) +
- A callback method should be passed to the method. +If set, the api works in async mode. +Required argument when working with twisted or tornado .
- error: (optional)
- Optional variable. An error method can be passed to the method. If set, the api works in async mode. @@ -1238,34 +1218,36 @@ Required argument when working with twisted or tornado .
- Returns: -
Sync Mode: dict -channel_group_remove_namespace method returns a dict indicating status of the request
--
-
- { -
- u’status’: 200, -u’message’: ‘OK’, -u’service’: u’channel-registry’, -u’error’: False -
}
+Sync Mode: dict
+channel_group_remove_namespace method returns a dict indicating +status of the request:
++{ + u'status': 200, + u'message': 'OK', + u'service': u'channel-registry', + u'error': False +} +
Async Mode: None ( callback gets the response as parameter )
Response Format:
-The callback passed to channel_group_list_namespaces gets the a dict indicating status of the request
--
-
- { -
- u’status’: 200, -u’message’: ‘OK’, -u’service’: u’channel-registry’, -u’error’: False -
}
+The callback passed to channel_group_list_namespaces gets the a +dict indicating status of the request:
++{ + u'status': 200, + u'message': 'OK', + u'service': u'channel-registry', + u'error': False +} +
- -decrypt(message)¶ +
-
+
decrypt(message)¶ Method for decrypting data.
This method takes ciphertext as input and returns decrypted data. This need not be called directly as enncryption/decryption is @@ -1280,8 +1262,8 @@ provided at time of initializing pubnub object
- -encrypt(message)¶ +
-
+
encrypt(message)¶ Method for encrypting data.
This method takes plaintext as input and returns encrypted data. This need not be called directly as enncryption/decryption is @@ -1296,8 +1278,8 @@ provided at time of initializing pubnub object
- -grant(channel=None, channel_group=None, auth_key=False, read=False, write=False, manage=False, ttl=5, callback=None, error=None)¶ +
-
+
grant(channel=None, channel_group=None, auth_key=False, read=False, write=False, manage=False, ttl=5, callback=None, error=None)¶ Method for granting permissions.
This function establishes subscribe and/or write permissions for PubNub Access Manager (PAM) by setting the read or write attribute @@ -1340,7 +1322,7 @@ Read permissions are removed by setting to False.
- write: (boolean) (default: True)
- Write permissions are granted by setting to true. Write permissions are removed by setting to false. -
- manage: (boolean) (default: True) +
- manage: (boolean) (default: True)
- Manage permissions are granted by setting to true. Manage permissions are removed by setting to false.
- ttl: (int) (default: 1440 i.e 24 hrs) @@ -1360,31 +1342,28 @@ Required argument when working with twisted or tornado .
- Returns:
Returns a dict in sync mode i.e. when callback argument is not given The dict returned contains values with keys ‘message’ and ‘payload’
-Sample Response: -{
--
-“message”:”Success”, -“payload”:{
--
-“ttl”:5, -“auths”:{
--
-“my_ro_authkey”:{“r”:1,”w”:0}}, -“subscribe_key”:”my_subkey”, -“level”:”user”, -“channel”:”my_channel”
-}
-}
+Sample Response:
++{ + "message":"Success", + "payload":{ + "ttl":5, + "auths":{ + "my_ro_authkey":{"r":1,"w":0} + }, + "subscribe_key":"my_subkey", + "level":"user", + "channel":"my_channel" + } +} +
- -here_now(channel, callback=None, error=None)¶ +
-
+
here_now(channel, uuids=True, state=False, callback=None, error=None)¶ Get here now data.
You can obtain information about the current state of a channel including a list of unique user-ids currently subscribed to the channel and the total @@ -1413,26 +1392,25 @@ Async Mode: None
The here_now() method returns a list of uuid s currently subscribed to the channel.
uuids:[“String”,”String”, ... ,”String”] - List of UUIDs currently subscribed to the channel.
occupancy: Number - Total current occupancy of the channel.
-Example Response: -{
--
-occupancy: 4, -uuids: [
--
-‘123123234t234f34fq3dq’, -‘143r34f34t34fq34q34q3’, -‘23f34d3f4rq34r34rq23q’, -‘w34tcw45t45tcw435tww3’,]
-}
+Example Response:
++{ + occupancy: 4, + uuids: [ + '123123234t234f34fq3dq', + '143r34f34t34fq34q34q3', + '23f34d3f4rq34r34rq23q', + 'w34tcw45t45tcw435tww3', + ] +} +
- -history(channel, count=100, reverse=False, start=None, end=None, callback=None, error=None)¶ +
-
+
history(channel, count=100, reverse=False, start=None, end=None, include_token=False, callback=None, error=None)¶ This method fetches historical messages of a channel.
PubNub Storage/Playback Service provides real-time access to an unlimited history for all messages published to PubNub. Stored messages are replicated @@ -1476,19 +1454,18 @@ Required argument when working with twisted or tornado .
- -presence(channel, callback, error=None)¶ +
-
+
presence(channel, callback, error=None, connect=None, disconnect=None, reconnect=None)¶ Subscribe to presence events on a channel.
Only works in async mode- Args: -
channel: Channel name ( string ) on which to listen for events -callback: A callback method should be passed as parameter.
--
+If passed, the api works in async mode. -Required argument when working with twisted or tornado .channel: Channel name ( string ) on which to listen for events
-
+
- callback: A callback method should be passed as parameter. +
- If passed, the api works in async mode. +Required argument when working with twisted or tornado .
- error: Optional variable. An error method can be passed as parameter.
- If set, the api works in async mode.
PubnubTwisted¶
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -presence_group(channel_group, callback, error=None)¶ +
-
+
presence_group(channel_group, callback, error=None, connect=None, disconnect=None, reconnect=None)¶ Subscribe to presence events on a channel group.
Only works in async mode- Args: -
channel_group: Channel group name ( string ) -callback: A callback method should be passed to the method.
--
+If passed, the api works in async mode. -Required argument when working with twisted or tornado .channel_group: Channel group name ( string )
-
+
- callback: A callback method should be passed to the method. +
- If passed, the api works in async mode. +Required argument when working with twisted or tornado .
- error: Optional variable. An error method can be passed as parameter.
- If passed, the api works in async mode.