diff options
author | engn33r <engn33r@users.noreply.github.com> | 2022-08-25 00:00:00 +0000 |
---|---|---|
committer | engn33r <engn33r@users.noreply.github.com> | 2022-08-25 00:00:00 +0000 |
commit | bd84b50d265501d98412604f106847ab3c49d5b3 (patch) | |
tree | 902290dbc43f63225dccef17be4cf66a031f61be | |
parent | 62ffdfe55c398869f61002c4b26b2da470d5c03f (diff) | |
download | websocket-client-bd84b50d265501d98412604f106847ab3c49d5b3.tar.gz |
Replace 'coming soon' in docs with valid examples
-rw-r--r-- | docs/source/examples.rst | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/docs/source/examples.rst b/docs/source/examples.rst index 6acea0a..26f18db 100644 --- a/docs/source/examples.rst +++ b/docs/source/examples.rst @@ -376,7 +376,12 @@ by default. You may encounter problems if using SSL/TLS with your proxy. **WebSocketApp proxy example** -`Work in progress - coming soon` +:: + + import websocket + + ws = websocket.WebSocketApp("ws://echo.websocket.events") + wsapp.run_forever(proxy_type="socks5", http_proxy_host=proxy_ip, http_proxy_auth=(proxy_username, proxy_password)) Connecting with Custom Sockets @@ -663,7 +668,23 @@ For instance, on_close, on_ping, on_pong, on_cont_message. One drawback of the c implementation (as of May 2021) is the lack of binary support for WebSocketApp, as noted by `issue #351 <https://github.com/websocket-client/websocket-client/issues/351>`_. -`Work in progress - coming soon` +.. doctest:: custom-opcode + + >>> import websocket + >>> websocket.enableTrace(True) + + >>> def on_open(wsapp): + ... wsapp.send("Hello") + + >>> def on_message(ws, message): + ... print(message) + ... ws.send("Send a ping", websocket.ABNF.OPCODE_PING) + + >>> def on_pong(wsapp, message): + ... print("Got a pong! No need to respond") + + >>> wsapp = websocket.WebSocketApp("ws://echo.websocket.events", on_open=on_open, on_message=on_message, on_pong=on_pong) + >>> wsapp.run_forever() # doctest: +SKIP Dispatching Multiple WebSocketApps ================================== |