aboutsummaryrefslogtreecommitdiffstats
path: root/python-tornado/examples
diff options
context:
space:
mode:
authorDevendra2013-02-24 04:56:45 +0530
committerDevendra2013-02-24 04:56:45 +0530
commit51b1dec8b04258f7bff59fb5bb4f69cbab52260c (patch)
tree6ae0186ea3876829784f66820fae097cc5800375 /python-tornado/examples
parent08c75762c1fd19b90f646a04072cb9bef60f5478 (diff)
downloadpubnub-python-51b1dec8b04258f7bff59fb5bb4f69cbab52260c.tar.bz2
saving working version
Diffstat (limited to 'python-tornado/examples')
-rw-r--r--python-tornado/examples/subscribe-example.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/python-tornado/examples/subscribe-example.py b/python-tornado/examples/subscribe-example.py
index c819f94..1a2e03d 100644
--- a/python-tornado/examples/subscribe-example.py
+++ b/python-tornado/examples/subscribe-example.py
@@ -12,6 +12,7 @@
import sys
import tornado
sys.path.append('../')
+sys.path.append('../..')
from Pubnub import Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
@@ -26,6 +27,17 @@ ssl_on = len(sys.argv) > 5 and bool(sys.argv[5]) or False
pubnub = Pubnub( publish_key, subscribe_key, secret_key,cipher_key, ssl_on )
crazy = 'hello_world'
+def connect_cb():
+ print 'Connect'
+
+def subscribe_result(response):
+ print response
+
+pubnub.subscribe({
+ 'channel' : crazy,
+ 'callback' : subscribe_result,
+ 'connect' : connect_cb
+})
## -----------------------------------------------------------------------
## Publish Example
## -----------------------------------------------------------------------
@@ -53,7 +65,6 @@ pubnub.publish({
'message' : { 'some_key' : 'some_val' },
'callback' : publish_complete
})
-
## -----------------------------------------------------------------------
## IO Event Loop
## -----------------------------------------------------------------------