Trio-websockets

Latest version: v0.2

Safety actively analyzes 619401 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

5.1

...

*In development*

5.0

...

.. note::

**Version 5.0 fixes a security issue introduced in version 4.0.**

websockets 4.0 was vulnerable to denial of service by memory exhaustion
because it didn't enforce ``max_size`` when decompressing compressed
messages.

.. warning::

**Version 5.0 adds a** ``user_info`` **field to the return value of**
:func:`~uri.parse_uri` **and** :class:`~uri.WebSocketURI` **.**

If you're unpacking :class:`~websockets.WebSocketURI` into four variables,
adjust your code to account for that fifth field.

Also:

* :func:`~client.connect()` performs HTTP Basic Auth when the URI contains
credentials.

* Iterating on incoming messages no longer raises an exception when the
connection terminates with code 1001 (going away).

* A plain HTTP request now receives a 426 Upgrade Required response and
doesn't log a stack trace.

* :func:`~server.unix_serve` can be used as an asynchronous context manager on
Python ≥ 3.5.1.

* Added :meth:`~protocol.WebSocketCommonProtocol.closed` property.

* If a :meth:`~protocol.WebSocketCommonProtocol.ping` doesn't receive a pong,
it's cancelled when the connection is closed.

* Reported the cause of :exc:`~exceptions.ConnectionClosed` exceptions.

* Added new examples in the documentation.

* Updated documentation with new features from Python 3.6.

* Improved several other sections of the documentation.

* Fixed missing close code, which caused :exc:`TypeError` on connection close.

* Fixed a race condition in the closing handshake that raised
:exc:`~exceptions.InvalidState`.

* Stopped logging stack traces when the TCP connection dies prematurely.

* Prevented writing to a closing TCP connection during unclean shutdowns.

* Made connection termination more robust to network congestion.

* Prevented processing of incoming frames after failing the connection.

4.0

...

.. warning::

**Version 4.0 enables compression with the permessage-deflate extension.**

In August 2017, Firefox and Chrome support it, but not Safari and IE.

Compression should improve performance but it increases RAM and CPU use.

If you want to disable compression, add ``compression=None`` when calling
:func:`~server.serve()` or :func:`~client.connect()`.

.. warning::

**Version 4.0 removes the** ``state_name`` **attribute of protocols.**

Use ``protocol.state.name`` instead of ``protocol.state_name``.

Also:

* :class:`~protocol.WebSocketCommonProtocol` instances can be used as
asynchronous iterators on Python ≥ 3.6. They yield incoming messages.

* Added :func:`~server.unix_serve` for listening on Unix sockets.

* Added the :attr:`~server.WebSocketServer.sockets` attribute.

* Reorganized and extended documentation.

* Aborted connections if they don't close within the configured ``timeout``.

* Rewrote connection termination to increase robustness in edge cases.

* Stopped leaking pending tasks when :meth:`~asyncio.Task.cancel` is called on
a connection while it's being closed.

* Reduced verbosity of "Failing the WebSocket connection" logs.

* Allowed ``extra_headers`` to override ``Server`` and ``User-Agent`` headers.

3.4

...

* Renamed :func:`~server.serve()` and :func:`~client.connect()`'s ``klass``
argument to ``create_protocol`` to reflect that it can also be a callable.
For backwards compatibility, ``klass`` is still supported.

* :func:`~server.serve` can be used as an asynchronous context manager on
Python ≥ 3.5.1.

* Added support for customizing handling of incoming connections with
:meth:`~server.WebSocketServerProtocol.process_request()`.

* Made read and write buffer sizes configurable.

* Rewrote HTTP handling for simplicity and performance.

* Added an optional C extension to speed up low level operations.

* An invalid response status code during :func:`~client.connect()` now raises
:class:`~exceptions.InvalidStatusCode` with a ``code`` attribute.

* Providing a ``sock`` argument to :func:`~client.connect()` no longer
crashes.

3.3

...

* Reduced noise in logs caused by connection resets.

* Avoided crashing on concurrent writes on slow connections.

3.2

...

* Added ``timeout``, ``max_size``, and ``max_queue`` arguments to
:func:`~client.connect()` and :func:`~server.serve()`.

* Made server shutdown more robust.

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.