aboutsummaryrefslogtreecommitdiff
path: root/i3/bin/cloogle_stats.py
diff options
context:
space:
mode:
authorCamil Staps2017-03-21 09:55:51 +0100
committerCamil Staps2017-03-21 09:55:51 +0100
commit10da737f7a8c3714b3050117412f44c97f215ee2 (patch)
tree046e5b9fa6f3f6dea434fd98f40e23d5b0b493af /i3/bin/cloogle_stats.py
parentCleanup .profile PATH (diff)
Connection info
Diffstat (limited to 'i3/bin/cloogle_stats.py')
-rwxr-xr-xi3/bin/cloogle_stats.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/i3/bin/cloogle_stats.py b/i3/bin/cloogle_stats.py
index 331fa93..8548953 100755
--- a/i3/bin/cloogle_stats.py
+++ b/i3/bin/cloogle_stats.py
@@ -23,18 +23,22 @@ def on_message(ws, msg):
except:
pass
+def on_open(ws):
+ print('Opened connection.')
+
def on_error(ws, err):
print(err)
def on_close(ws):
- print('Lost connection to Cloogle.')
+ print('Lost connection.')
time.sleep(3)
start()
def start():
ws = websocket.WebSocketApp('wss://cloogle.org:31216',
subprotocols=['cloogle-stats'],
- on_message=on_message, on_error=on_error, on_close=on_close)
+ on_message=on_message,
+ on_open=on_open, on_error=on_error, on_close=on_close)
ws.run_forever(sslopt={'cert_reqs': ssl.CERT_NONE})
if __name__ == '__main__':