From 1d3a0685aa346ce5ec0b45d5744c2044efd03fff Mon Sep 17 00:00:00 2001 From: Jeroen van der Heijden Date: Wed, 10 Apr 2024 12:54:18 +0200 Subject: [PATCH] Update README.md --- README.md | 9 ++++++++- requirements.txt | 2 ++ thingsdb/client/protocol.py | 5 +++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 63222e2..99e43d6 100644 --- a/README.md +++ b/README.md @@ -626,9 +626,16 @@ set_package_fail_file('/tmp/thingsdb-invalid-data.mp') ## WebSockets Since ThingsDB 1.6 has received WebSocket support. The Python client is able to use the WebSockets protocol by providing the `host` as URI. - For WebSocket connections,the `port` argument will be ignored and must be specified with the URI instead. +Default the `websockets` package is **not included** when installing this connector. + +If you want to use WebSockets, make sure to install the package: + +``` +pip install websockets +``` + For example: ```python diff --git a/requirements.txt b/requirements.txt index cefb916..a887750 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ msgpack>=0.6.2 deprecation +# Optional package: +# websockets \ No newline at end of file diff --git a/thingsdb/client/protocol.py b/thingsdb/client/protocol.py index ba350b5..fcdac48 100644 --- a/thingsdb/client/protocol.py +++ b/thingsdb/client/protocol.py @@ -347,8 +347,9 @@ def __init__( assert type(websockets).__name__ == 'module' except Exception: raise ImportError( - 'missing module `websockets`; ' - 'install `websockets` using: \n\n pip install websockets\n\n') + 'missing `websockets` module; ' + 'please install the `websockets` module: ' + '\n\n pip install websockets\n\n') self._proto: WebSocketClientProtocol = None self._is_closing = False