diff options
| author | Geremy Cohen | 2014-06-16 13:36:30 -0700 | 
|---|---|---|
| committer | Geremy Cohen | 2014-06-16 13:36:30 -0700 | 
| commit | 05dbe7714645c65bce4a73ec11d8d424f5fae296 (patch) | |
| tree | e98273941ac43c7c0b5fe7a26933e8c1c829805e /python | |
| parent | 30202de8be4ba24f4fba8dda4b3f28f6ee6600aa (diff) | |
| download | pubnub-python-05dbe7714645c65bce4a73ec11d8d424f5fae296.tar.bz2 | |
Update README.md
Diffstat (limited to 'python')
| -rw-r--r-- | python/README.md | 48 | 
1 files changed, 48 insertions, 0 deletions
| diff --git a/python/README.md b/python/README.md index 14d767f..10d03ae 100644 --- a/python/README.md +++ b/python/README.md @@ -5,7 +5,14 @@  #### Init + +  ``` + +# Pre 3.5: +# + +# New in 3.5+  pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False)  ``` @@ -16,6 +23,11 @@ pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False)  channel = 'hello_world'  message = 'Hello World !!!' +# Pre 3.5: +# + +# New in 3.5+ +  # Synchronous usage  print pubnub.publish(channel='hello_world', message='Hello World !!!') @@ -30,12 +42,19 @@ pubnub.publish(channel, message, callback=callback, error=callback)  #### SUBSCRIBE +Pre 3.5.x, subscribe was blocking and would only be terminated via a false return from the callback. In our latest version of the SDK, subscribe is asyncronous, and because of this, usage is a bit different, but the experience is more like our other async SDKs.  ``` +  # Listen for Messages  channel = 'hello_world' +# Pre 3.5: +# + +# New in 3.5+ +  def callback(message, channel):      print(message) @@ -60,10 +79,27 @@ pubnub.subscribe(channel, callback=callback, error=callback,                   connect=connect, reconnect=reconnect, disconnect=disconnect)  ``` +#### Unsubscribe +Once subscribed, you can easily, gracefully, unsubscribe: + +``` +# Pre 3.5: +# + +# New in 3.5+ + +Unsub example +```  #### PRESENCE  ``` + +# Pre 3.5: +# + +# New in 3.5+ +  # Listen for Presence Event Messages  channel = 'hello_world' @@ -83,6 +119,12 @@ pubnub.presence(channel, callback=callback, error=callback)  #### HERE_NOW  ``` + +# Pre 3.5: +# + +# New in 3.5+ +  # Get info on who is here right now!  channel = 'hello_world' @@ -102,6 +144,12 @@ pubnub.here_now(channel, callback=callback, error=callback)  #### HISTORY  ``` + +# Pre 3.5: +# + +# New in 3.5+ +  # Synchronous usage  print pubnub.history(channel, count=2) | 
