| 1 |
Environment variables |
| 2 |
===================== |
| 3 |
|
| 4 |
.. currentmodule:: websockets |
| 5 |
|
| 6 |
Logging |
| 7 |
------- |
| 8 |
|
| 9 |
.. envvar:: WEBSOCKETS_MAX_LOG_SIZE |
| 10 |
|
| 11 |
How much of each frame to show in debug logs. |
| 12 |
|
| 13 |
The default value is ``75``. |
| 14 |
|
| 15 |
See the :doc:`logging guide <../topics/logging>` for details. |
| 16 |
|
| 17 |
Security |
| 18 |
-------- |
| 19 |
|
| 20 |
.. envvar:: WEBSOCKETS_SERVER |
| 21 |
|
| 22 |
Server header sent by websockets. |
| 23 |
|
| 24 |
The default value uses the format ``"Python/x.y.z websockets/X.Y"``. |
| 25 |
|
| 26 |
.. envvar:: WEBSOCKETS_USER_AGENT |
| 27 |
|
| 28 |
User-Agent header sent by websockets. |
| 29 |
|
| 30 |
The default value uses the format ``"Python/x.y.z websockets/X.Y"``. |
| 31 |
|
| 32 |
.. envvar:: WEBSOCKETS_MAX_LINE_LENGTH |
| 33 |
|
| 34 |
Maximum length of the request or status line in the opening handshake. |
| 35 |
|
| 36 |
The default value is ``8192`` bytes. |
| 37 |
|
| 38 |
.. envvar:: WEBSOCKETS_MAX_NUM_HEADERS |
| 39 |
|
| 40 |
Maximum number of HTTP headers in the opening handshake. |
| 41 |
|
| 42 |
The default value is ``128`` bytes. |
| 43 |
|
| 44 |
.. envvar:: WEBSOCKETS_MAX_BODY_SIZE |
| 45 |
|
| 46 |
Maximum size of the body of an HTTP response in the opening handshake. |
| 47 |
|
| 48 |
The default value is ``1_048_576`` bytes (1 MiB). |
| 49 |
|
| 50 |
See the :doc:`security guide <../topics/security>` for details. |
| 51 |
|
| 52 |
Reconnection |
| 53 |
------------ |
| 54 |
|
| 55 |
Reconnection attempts are spaced out with truncated exponential backoff. |
| 56 |
|
| 57 |
.. envvar:: WEBSOCKETS_BACKOFF_INITIAL_DELAY |
| 58 |
|
| 59 |
The first attempt is delayed by a random amount of time between ``0`` and |
| 60 |
``WEBSOCKETS_BACKOFF_INITIAL_DELAY`` seconds. |
| 61 |
|
| 62 |
The default value is ``5.0`` seconds. |
| 63 |
|
| 64 |
.. envvar:: WEBSOCKETS_BACKOFF_MIN_DELAY |
| 65 |
|
| 66 |
The second attempt is delayed by ``WEBSOCKETS_BACKOFF_MIN_DELAY`` seconds. |
| 67 |
|
| 68 |
The default value is ``3.1`` seconds. |
| 69 |
|
| 70 |
.. envvar:: WEBSOCKETS_BACKOFF_FACTOR |
| 71 |
|
| 72 |
After the second attempt, the delay is multiplied by |
| 73 |
``WEBSOCKETS_BACKOFF_FACTOR`` between each attempt. |
| 74 |
|
| 75 |
The default value is ``1.618``. |
| 76 |
|
| 77 |
.. envvar:: WEBSOCKETS_BACKOFF_MAX_DELAY |
| 78 |
|
| 79 |
The delay between attempts is capped at ``WEBSOCKETS_BACKOFF_MAX_DELAY`` |
| 80 |
seconds. |
| 81 |
|
| 82 |
The default value is ``90.0`` seconds. |
| 83 |
|
| 84 |
Redirects |
| 85 |
--------- |
| 86 |
|
| 87 |
.. envvar:: WEBSOCKETS_MAX_REDIRECTS |
| 88 |
|
| 89 |
Maximum number of redirects that :func:`~asyncio.client.connect` follows. |
| 90 |
|
| 91 |
The default value is ``10``. |