aboutsummaryrefslogtreecommitdiffstats
path: root/python-tornado/README.md
diff options
context:
space:
mode:
authorDevendra2014-06-18 01:02:15 +0530
committerDevendra2014-06-18 01:02:15 +0530
commita1ee7f8bd90b463318bfa75f7ee4f58d458d2a24 (patch)
tree9e260902f960f792a93fa25e3b619c42ecb5f4d4 /python-tornado/README.md
parentbfd5c64bdf7ed45f21207cb53c653e7220e39eff (diff)
parent083127cde127dd78fc88ffe2b3b82144b2c07038 (diff)
downloadpubnub-python-a1ee7f8bd90b463318bfa75f7ee4f58d458d2a24.tar.bz2
Merge branch 'master' into develop
Diffstat (limited to 'python-tornado/README.md')
-rw-r--r--python-tornado/README.md105
1 files changed, 105 insertions, 0 deletions
diff --git a/python-tornado/README.md b/python-tornado/README.md
new file mode 100644
index 0000000..53aad32
--- /dev/null
+++ b/python-tornado/README.md
@@ -0,0 +1,105 @@
+## 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
+```
+from Pubnub import PubnubTornado as Pubnub
+```
+
+#### Init
+```
+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)
+```
+
+#### 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)
+```
+
+#### 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
+```
+pubnub.start()
+```
+
+## Contact support@pubnub.com for all questions