aboutsummaryrefslogtreecommitdiffstats
path: root/python/examples/subscribe.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/examples/subscribe.py')
-rw-r--r--python/examples/subscribe.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/python/examples/subscribe.py b/python/examples/subscribe.py
index a410297..6cf93b1 100644
--- a/python/examples/subscribe.py
+++ b/python/examples/subscribe.py
@@ -21,26 +21,29 @@ ssl_on = len(sys.argv) > 5 and bool(sys.argv[5]) or False
pubnub = Pubnub(publish_key=publish_key, subscribe_key=subscribe_key,
secret_key=secret_key, cipher_key=cipher_key, ssl_on=ssl_on)
-channel = 'a'
-
+channel = 'a'
# Asynchronous usage
-
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)
+pubnub.subscribe(channel, callback=callback, error=callback,
+ connect=connect, reconnect=reconnect, disconnect=disconnect)