aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorDevendra2014-04-30 17:14:09 +0530
committerDevendra2014-04-30 17:14:09 +0530
commit10f345fcf4edb489cf9b86039c030baa62a6881c (patch)
tree222417d67b02affa861351042e98075eaeeed2ea /python
parente2ccbc05b6ed2696dd8d2d2134b2023c528e1b70 (diff)
downloadpubnub-python-10f345fcf4edb489cf9b86039c030baa62a6881c.tar.bz2
adding persistent connectino support
Diffstat (limited to 'python')
-rwxr-xr-xpython/examples/publish-example.py40
1 files changed, 7 insertions, 33 deletions
diff --git a/python/examples/publish-example.py b/python/examples/publish-example.py
index 1c57e4b..78b7f36 100755
--- a/python/examples/publish-example.py
+++ b/python/examples/publish-example.py
@@ -21,7 +21,7 @@ ssl_on = len(sys.argv) > 6 and bool(sys.argv[5]) or False
## Initiate Pubnub State
## -----------------------------------------------------------------------
pubnub = Pubnub(
- publish_key, subscribe_key, secret_key, cipher_key, auth_key, ssl_on)
+ publish_key, subscribe_key, secret_key, cipher_key, auth_key, ssl_on, pooling=True)
crazy = 'hello_world'
## -----------------------------------------------------------------------
@@ -36,35 +36,9 @@ def publish_complete(info):
def publish_error(info):
print('ERROR : ' + str(info))
-## Publish string
-pubnub.publish({
- 'channel': crazy,
- 'message': 'Hello World!',
- 'callback': publish_complete,
- 'error': publish_error
-})
-
-## Publish list
-li = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday',
- 'Saturday']
-
-pubnub.publish({
- 'channel': crazy,
- 'message': li,
- 'callback': publish_complete,
- 'error': publish_error
-})
-
-
-def done_cb(info):
- publish_complete(info)
-
-pubnub.publish({
- 'channel': crazy,
- 'message': {'some_key': 'some_val'},
- 'callback': done_cb,
- 'error': publish_error
-})
-
-
-pubnub.start()
+import time
+start = time.time()
+for i in range(1,100):
+ print pubnub.publish(crazy, 'hello world-' + str(i))
+end = time.time()
+print(end - start);