From c731ae584de53da55ed799f8fd59bff10b9b9b72 Mon Sep 17 00:00:00 2001 From: Devendra Date: Tue, 17 Jun 2014 02:43:16 +0530 Subject: readme changes --- python-tornado/README.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 python-tornado/README.md (limited to 'python-tornado/README.md') diff --git a/python-tornado/README.md b/python-tornado/README.md new file mode 100644 index 0000000..1d210f9 --- /dev/null +++ b/python-tornado/README.md @@ -0,0 +1,61 @@ +## PubNub 3.5.0 Web Data Push Cloud-hosted API - PYTHON TORNADO +#### www.pubnub.com - PubNub Web Data Push Service in the Cloud. +#### http://github.com/pubnub/python + +#### Import +``` +from Pubnub import PubnubTornado as Pubnub +``` + +#### Init +pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False) + + +#### IO Event Loop +##### VERY IMPORTANT TO ADD THIS LINE AT THE VERY BOTTOM! + +``` +pubnub.start() +``` + +#### Subscribe Example +``` +channel = 'hello_world' + +def callback(message, channel): + print(message) + + +def error(message): + print("ERROR : " + str(message)) + + +def connect(message): + print("CONNECTED") + + +def reconnect(message): + print("RECONNECTED") + + +def disconnect(message): + print("DISCONNECTED") + + +pubnub.subscribe(channel, callback=callback, error=callback, + connect=connect, reconnect=reconnect, disconnect=disconnect) +``` + +#### History Example +``` +def callback(message): + print(message) + +pubnub.history(channel, count=2, callback=callback, error=callback) +``` + + +#### IO Event Loop start +``` +pubnub.start() +``` \ No newline at end of file -- cgit v1.2.3 From 2419ac0419fe74b582b94ed7784b3732049db9f2 Mon Sep 17 00:00:00 2001 From: Devendra Date: Tue, 17 Jun 2014 03:27:05 +0530 Subject: readme changes --- python-tornado/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'python-tornado/README.md') diff --git a/python-tornado/README.md b/python-tornado/README.md index 1d210f9..406b556 100644 --- a/python-tornado/README.md +++ b/python-tornado/README.md @@ -11,6 +11,20 @@ from Pubnub import PubnubTornado as Pubnub pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False) +#### Publish Example +``` +channel = 'hello_world' +message = 'Hello World !!!' + +# Asynchronous usage + + +def callback(message): + print(message) + +pubnub.publish(channel, message, callback=callback, error=callback) +``` + #### IO Event Loop ##### VERY IMPORTANT TO ADD THIS LINE AT THE VERY BOTTOM! -- cgit v1.2.3 From 6363edd8797f914af23612bd576462dcceb408f2 Mon Sep 17 00:00:00 2001 From: Devendra Date: Tue, 17 Jun 2014 03:31:40 +0530 Subject: readme changes --- python-tornado/README.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'python-tornado/README.md') diff --git a/python-tornado/README.md b/python-tornado/README.md index 406b556..61146ea 100644 --- a/python-tornado/README.md +++ b/python-tornado/README.md @@ -8,8 +8,9 @@ from Pubnub import PubnubTornado as Pubnub ``` #### Init +``` pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False) - +``` #### Publish Example ``` @@ -68,6 +69,32 @@ def callback(message): pubnub.history(channel, count=2, callback=callback, error=callback) ``` +#### Here Now Example +``` +def callback(message): + print(message) + +pubnub.here_now(channel, callback=callback, error=callback) +``` + +#### Presence Example +``` +channel = 'hello_world' + +def callback(message, channel): + print(message) + + +def error(message): + print("ERROR : " + str(message)) + +pubnub.presence(channel, callback=callback, error=callback) +``` + +#### Unsubscribe Example +``` +pubnub.unsubscribe(channel='hello_world') +``` #### IO Event Loop start ``` -- cgit v1.2.3 From 1c997e33c70095b7bb3af36120e9a384e6a512d9 Mon Sep 17 00:00:00 2001 From: Geremy Cohen Date: Mon, 16 Jun 2014 15:45:35 -0700 Subject: Update README.md --- python-tornado/README.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'python-tornado/README.md') diff --git a/python-tornado/README.md b/python-tornado/README.md index 61146ea..53aad32 100644 --- a/python-tornado/README.md +++ b/python-tornado/README.md @@ -1,6 +1,14 @@ -## PubNub 3.5.0 Web Data Push Cloud-hosted API - PYTHON TORNADO -#### www.pubnub.com - PubNub Web Data Push Service in the Cloud. -#### http://github.com/pubnub/python +## Contact support@pubnub.com for all questions + +#### [PubNub](http://www.pubnub.com) Real-time Data Network +##### Tornado Client + +## IO Event Loop +Be sure to eventually start the event loop or PubNub won't run! + +``` +pubnub.start() +``` #### Import ``` @@ -26,13 +34,6 @@ def callback(message): pubnub.publish(channel, message, callback=callback, error=callback) ``` -#### IO Event Loop -##### VERY IMPORTANT TO ADD THIS LINE AT THE VERY BOTTOM! - -``` -pubnub.start() -``` - #### Subscribe Example ``` channel = 'hello_world' @@ -99,4 +100,6 @@ pubnub.unsubscribe(channel='hello_world') #### IO Event Loop start ``` pubnub.start() -``` \ No newline at end of file +``` + +## Contact support@pubnub.com for all questions -- cgit v1.2.3