summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/websocketprovider.py9
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")