summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorengn33r <engn33r@users.noreply.github.com>2022-02-25 14:42:50 -0500
committerengn33r <engn33r@users.noreply.github.com>2022-02-25 14:42:50 -0500
commit7723b743fb071ac12b1072f5b655ef5ba2dc46fb (patch)
treeb1989ade9eb666b48a569acfdb2d9f05a9ecd10a
parent23df64f0d1080d43fb13b0520093c11350688b19 (diff)
downloadwebsocket-client-7723b743fb071ac12b1072f5b655ef5ba2dc46fb.tar.gz
Minor improvement of example documentation
-rw-r--r--docs/source/examples.rst12
1 files changed, 9 insertions, 3 deletions
diff --git a/docs/source/examples.rst b/docs/source/examples.rst
index 26f2ac4..aa1a4c2 100644
--- a/docs/source/examples.rst
+++ b/docs/source/examples.rst
@@ -169,12 +169,16 @@ For debugging, remember that it is helpful to enable :ref:`Debug and Logging Opt
**WebSocket subprotocols example**
+Use this to specify STOMP, WAMP, MQTT, or other values of the "Sec-WebSocket-Protocol" header.
+Be aware that websocket-client does not include support for these protocols,
+so your code must handle the data sent over the WebSocket connection.
+
::
import websocket
ws = websocket.WebSocket()
- ws.connect("wss://ws.kraken.com", subprotocols=["testproto"])
+ ws.connect("wss://ws.kraken.com", subprotocols=["mqtt"])
**WebSocketApp subprotocols example**
@@ -186,7 +190,7 @@ For debugging, remember that it is helpful to enable :ref:`Debug and Logging Opt
print(message)
wsapp = websocket.WebSocketApp("wss://ws.kraken.com",
- subprotocols=["testproto"], on_message=on_message)
+ subprotocols=["STOMP"], on_message=on_message)
wsapp.run_forever()
Suppress Origin Header
@@ -227,6 +231,8 @@ Setting custom header values, other than ``Host``, ``Origin``, ``Cookie``, or
handshake request is similar to setting common header values. Use the ``header``
option to provide custom header values in a list or dict.
For debugging, remember that it is helpful to enable :ref:`Debug and Logging Options`.
+There is no built-in support for "Sec-WebSocket-Extensions" header values as
+defined in RFC 7692.
**WebSocket custom headers example**
@@ -320,7 +326,7 @@ the timeout interval (5 seconds in the example below).
import websocket
def on_error(wsapp, err):
- print("Got a an error: ", err)
+ print("EXAMPLE error encountered: ", err)
websocket.setdefaulttimeout(5)
wsapp = websocket.WebSocketApp("ws://nexus-websocket-a.intercom.io",