diff options
| author | engn33r <engn33r@users.noreply.github.com> | 2021-02-06 23:49:22 -0500 |
|---|---|---|
| committer | engn33r <engn33r@users.noreply.github.com> | 2021-02-06 23:49:22 -0500 |
| commit | 6d9cb403a83b2595dd921d9ef9ff9ca0522ffe96 (patch) | |
| tree | 21d4e93e3b9d3cc7181c49c0e9b7eaac9a2abfb1 /docs | |
| parent | c1f0561f6e46252459fcd572c700d78504d45603 (diff) | |
| download | websocket-client-6d9cb403a83b2595dd921d9ef9ff9ca0522ffe96.tar.gz | |
Add suppress origin example to documentation
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/source/examples.rst | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/docs/source/examples.rst b/docs/source/examples.rst index 2f7db06..b519f46 100644 --- a/docs/source/examples.rst +++ b/docs/source/examples.rst @@ -172,6 +172,36 @@ For debugging, remember that it is helpful to enable :ref:`Debug and Logging Opt subprotocols=["testproto"], on_message=on_message) wsapp.run_forever() +Suppress Origin Header +------------------------- + +There is a special ``suppress_origin`` option that can be used to remove the +``Origin`` header from connection handshake requests. The below examples +illustrate how this can be used. +For debugging, remember that it is helpful to enable :ref:`Debug and Logging Options`. + +**WebSocket suppress origin example** + +:: + + import websocket + + ws = websocket.WebSocket() + ws.connect("ws://echo.websocket.org", suppress_origin=True) + +**WebSocketApp suppress origin example** + +:: + + import websocket + + def on_message(wsapp, message): + print(message) + + wsapp = websocket.WebSocketApp("wss://stream.meetup.com/2/rsvps", + on_message=on_message) + wsapp.run_forever(suppress_origin=True) + Setting Custom Header Values -------------------------------- @@ -204,7 +234,7 @@ For debugging, remember that it is helpful to enable :ref:`Debug and Logging Opt header={"CustomHeader1":"123", "NewHeader2":"Test"}, on_message=on_message) wsapp.run_forever() -Disabling SSL or hostname verification +Disabling SSL or Hostname Verification --------------------------------------- See the relevant :ref:`FAQ` page for instructions. |
