diff options
| author | Devendra | 2014-04-30 17:14:09 +0530 | 
|---|---|---|
| committer | Devendra | 2014-04-30 17:14:09 +0530 | 
| commit | 10f345fcf4edb489cf9b86039c030baa62a6881c (patch) | |
| tree | 222417d67b02affa861351042e98075eaeeed2ea /python/examples | |
| parent | e2ccbc05b6ed2696dd8d2d2134b2023c528e1b70 (diff) | |
| download | pubnub-python-10f345fcf4edb489cf9b86039c030baa62a6881c.tar.bz2 | |
adding persistent connectino support
Diffstat (limited to 'python/examples')
| -rwxr-xr-x | python/examples/publish-example.py | 40 | 
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); | 
