Skip to content

Commit 7c8e0b9

Browse files
committed
Document removal of open and closed properties.
They won't be added to the new asyncio implementation.
1 parent 8d9f9a1 commit 7c8e0b9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/howto/upgrade.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,3 +371,29 @@ buffer now.
371371

372372
The ``write_limit`` argument of :func:`~asyncio.client.connect` and
373373
:func:`~asyncio.server.serve` defaults to 32 KiB instead of 64 KiB.
374+
375+
Attributes of connections
376+
.........................
377+
378+
``open`` and ``closed``
379+
~~~~~~~~~~~~~~~~~~~~~~~
380+
381+
The :attr:`~legacy.protocol.WebSocketCommonProtocol.open` and
382+
:attr:`~legacy.protocol.WebSocketCommonProtocol.closed` properties are removed.
383+
Using them was discouraged.
384+
385+
Instead, you should call :meth:`~asyncio.connection.Connection.recv` or
386+
:meth:`~asyncio.connection.Connection.send` and handle
387+
:exc:`~exceptions.ConnectionClosed` exceptions.
388+
389+
If your code relies on them, you can replace::
390+
391+
connection.open
392+
connection.closed
393+
394+
with::
395+
396+
from websockets.protocol import State
397+
398+
connection.state is State.OPEN
399+
connection.state is State.CLOSED

0 commit comments

Comments
 (0)