diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2024-04-25 19:49:17 -0400 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2024-04-25 19:49:17 -0400 |
| commit | 92a87c0a3f981f8e0bd80789b9c19447227445dc (patch) | |
| tree | 31b39ec6944f739d467d060950fc3f3f245b6f55 /python/websocketprovider.py | |
| parent | 5ebad8c0b30227bf8f367267eaf17d366afd8608 (diff) | |
example python API documentation on websocket
Diffstat (limited to 'python/websocketprovider.py')
| -rw-r--r-- | python/websocketprovider.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/python/websocketprovider.py b/python/websocketprovider.py index 70239ccf..420f43c6 100644 --- a/python/websocketprovider.py +++ b/python/websocketprovider.py @@ -46,6 +46,9 @@ def to_bytes(field): class WebsocketClient(object): + """ + This class implements a websocket client. See :py:func:`~WebsocketClient.connect` for more details. + """ _registered_clients = [] def __init__(self, provider, handle=None): @@ -157,6 +160,12 @@ class WebsocketClient(object): :param function(bytes) -> bool on_data: function to call when data is read from the websocket :return: if the connection has started, but not necessarily if it succeeded :rtype: bool + + :Example: + >>> provider = list(WebsocketProvider)[0] + >>> client = provider.create_instance() + >>> client.connect("ws://localhost:8080", {}) + True """ if self._connected: raise RuntimeError("Cannot use connect() twice on the same WebsocketClient") |
