Name Description Size
__init__.py 5658
__main__.py Enable VT-100 for console output on Windows. See also https://bugs.python.org/issue29059. 4744
auth.py 262
client.py Sans-I/O implementation of a WebSocket client connection. Args: wsuri: URI of the WebSocket server, parsed with :func:`~websockets.uri.parse_uri`. origin: value of the ``Origin`` header. This is useful when connecting to a server that validates the ``Origin`` header to defend against Cross-Site WebSocket Hijacking attacks. extensions: list of supported extensions, in order in which they should be tried. subprotocols: list of supported subprotocols, in order of decreasing preference. state: initial state of the WebSocket connection. max_size: maximum size of incoming messages in bytes; :obj:`None` disables the limit. logger: logger for this connection; defaults to ``logging.getLogger("websockets.client")``; see the :doc:`logging guide <../../topics/logging>` for details. 12562
connection.py 333
datastructures.py Exception raised when :class:`Headers` has more than one value for a key. 5582
exceptions.py :mod:`websockets.exceptions` defines the following exception hierarchy: * :exc:`WebSocketException` * :exc:`ConnectionClosed` * :exc:`ConnectionClosedError` * :exc:`ConnectionClosedOK` * :exc:`InvalidHandshake` * :exc:`SecurityError` * :exc:`InvalidMessage` * :exc:`InvalidHeader` * :exc:`InvalidHeaderFormat` * :exc:`InvalidHeaderValue` * :exc:`InvalidOrigin` * :exc:`InvalidUpgrade` * :exc:`InvalidStatus` * :exc:`InvalidStatusCode` (legacy) * :exc:`NegotiationError` * :exc:`DuplicateParameter` * :exc:`InvalidParameterName` * :exc:`InvalidParameterValue` * :exc:`AbortHandshake` * :exc:`RedirectHandshake` * :exc:`InvalidState` * :exc:`InvalidURI` * :exc:`PayloadTooBig` * :exc:`ProtocolError` 10296
extensions
frames.py Opcode values for WebSocket frames. 13700
headers.py Build a ``Host`` header. 16120
http.py 897
http11.py Decode a bytestring for interpolating into an error message. 12565
imports.py Import ``name`` from ``source`` in ``namespace``. There are two use cases: - ``name`` is an object defined in ``source``; - ``name`` is a submodule of ``source``. Neither :func:`__import__` nor :func:`~importlib.import_module` does exactly this. :func:`__import__` is closer to the intended behavior. 2790
legacy
protocol.py Events that :meth:`~Protocol.events_received` may return. 24002
py.typed 0
server.py Sans-I/O implementation of a WebSocket server connection. Args: origins: acceptable values of the ``Origin`` header; include :obj:`None` in the list if the lack of an origin is acceptable. This is useful for defending against Cross-Site WebSocket Hijacking attacks. extensions: list of supported extensions, in order in which they should be tried. subprotocols: list of supported subprotocols, in order of decreasing preference. select_subprotocol: Callback for selecting a subprotocol among those supported by the client and the server. It has the same signature as the :meth:`select_subprotocol` method, including a :class:`ServerProtocol` instance as first argument. state: initial state of the WebSocket connection. max_size: maximum size of incoming messages in bytes; :obj:`None` disables the limit. logger: logger for this connection; defaults to ``logging.getLogger("websockets.client")``; see the :doc:`logging guide <../../topics/logging>` for details. 21136
speedups.c C implementation of performance sensitive functions. 5834
speedups.pyi 55
streams.py Generator-based stream reader. This class doesn't support concurrent calls to :meth:`read_line`, :meth:`read_exact`, or :meth:`read_to_eof`. Make sure calls are serialized. 4038
sync
typing.py Types supported in a WebSocket message: :class:`str` for a Text_ frame, :class:`bytes` for a Binary_. .. _Text: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6 .. _Binary : https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6 1527
uri.py WebSocket URI. Attributes: secure: :obj:`True` for a ``wss`` URI, :obj:`False` for a ``ws`` URI. host: Normalized to lower case. port: Always set even if it's the default. path: May be empty. query: May be empty if the URI doesn't include a query component. username: Available when the URI contains `User Information`_. password: Available when the URI contains `User Information`_. .. _User Information: https://www.rfc-editor.org/rfc/rfc3986.html#section-3.2.1 3215
utils.py Generate a random key for the Sec-WebSocket-Key header. 1150
version.py 2747