Environment variables

Logging

WEBSOCKETS_MAX_LOG_SIZE

How much of each frame to show in debug logs.

The default value is 75.

See the logging guide for details.

Security

WEBSOCKETS_SERVER

Server header sent by websockets.

The default value uses the format "Python/x.y.z websockets/X.Y".

WEBSOCKETS_USER_AGENT

User-Agent header sent by websockets.

The default value uses the format "Python/x.y.z websockets/X.Y".

WEBSOCKETS_MAX_LINE_LENGTH

Maximum length of the request or status line in the opening handshake.

The default value is 8192.

WEBSOCKETS_MAX_NUM_HEADERS

Maximum number of HTTP headers in the opening handshake.

The default value is 128.

WEBSOCKETS_MAX_BODY_SIZE

Maximum size of the body of an HTTP response in the opening handshake.

The default value is 1_048_576 (1 MiB).

See the security guide for details.