diff options
| author | gcohen | 2014-12-29 18:20:58 -0800 |
|---|---|---|
| committer | gcohen | 2014-12-29 18:20:58 -0800 |
| commit | 3a5a980b3c75e6eee176fdc23b63855cee30ceff (patch) | |
| tree | bddd7236c59f86876b155b989e2c9c661f6de69d | |
| parent | 9b525ef52e6d73bb6ed203e3889123502a61ebfd (diff) | |
| download | pubnub-python-3a5a980b3c75e6eee176fdc23b63855cee30ceff.tar.bz2 | |
initial commit
| -rw-r--r-- | python/examples/futureHouse/futureHouse.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/python/examples/futureHouse/futureHouse.py b/python/examples/futureHouse/futureHouse.py new file mode 100644 index 0000000..55286a2 --- /dev/null +++ b/python/examples/futureHouse/futureHouse.py @@ -0,0 +1,40 @@ +import sys +from Pubnub import Pubnub + +publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo' +subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo' +secret_key = len(sys.argv) > 3 and sys.argv[3] or 'demo' +cipher_key = len(sys.argv) > 4 and sys.argv[4] or '' +ssl_on = len(sys.argv) > 5 and bool(sys.argv[5]) or False + +## ----------------------------------------------------------------------- +## Initiate Pubnub State +## ----------------------------------------------------------------------- +pubnub = Pubnub(publish_key=publish_key, subscribe_key=subscribe_key, + secret_key=secret_key, cipher_key=cipher_key, ssl_on=ssl_on) + +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,
\ No newline at end of file |
