From c2abb5ba3174fd41176826816888228fd70fb739 Mon Sep 17 00:00:00 2001 From: boyska Date: Wed, 17 Aug 2022 22:10:17 +0200 Subject: [PATCH] wsclient reconnects automatically closes #6 --- README.md | 1 + utils/wsclient.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8dd9d8d..4293d25 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ a questo punto lancia `docker-compose up` ### GUI ``` +apt install python3-websocket ./utils/wsclient.py -k 'wss://localhost:8000/v1/ws/counter/0' | stdbuf -o0 jq .value | ./schermetto/num_display.py --no-fu --inve 4 ``` diff --git a/utils/wsclient.py b/utils/wsclient.py index e6ea682..0c688b2 100755 --- a/utils/wsclient.py +++ b/utils/wsclient.py @@ -1,6 +1,7 @@ #!/usr/bin/python3 -u import argparse import ssl +import time import websocket @@ -34,7 +35,9 @@ def main(): run_opts = {} if not args.ssl_verify: run_opts = {"sslopt": {"cert_reqs": ssl.CERT_NONE}} - wsapp.run_forever(**run_opts) + while True: + wsapp.run_forever(**run_opts) + time.sleep(1) if __name__ == "__main__":