From 2abd24c93cb6c2582a87fde686ef8f50dba58fde Mon Sep 17 00:00:00 2001 From: MtkN1 <51289448+MtkN1@users.noreply.github.com> Date: Wed, 7 Feb 2024 05:52:30 +0000 Subject: [PATCH] Add wsproto.Connection reference --- docs/source/api.rst | 4 ++++ src/wsproto/connection.py | 15 ++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/source/api.rst b/docs/source/api.rst index 9001109b..1c8583f1 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -19,6 +19,10 @@ Connection :special-members: __init__ :members: +.. autoclass:: wsproto.Connection + :special-members: __init__ + :members: + .. autoclass:: wsproto.ConnectionType :members: diff --git a/src/wsproto/connection.py b/src/wsproto/connection.py index 4439165e..5b07b396 100644 --- a/src/wsproto/connection.py +++ b/src/wsproto/connection.py @@ -63,11 +63,6 @@ class Connection: This wraps two other protocol objects, an HTTP/1.1 protocol object used to do the initial HTTP upgrade handshake and a WebSocket frame protocol object used to exchange messages and other control frames. - - :param conn_type: Whether this object is on the client- or server-side of - a connection. To initialise as a client pass ``CLIENT`` otherwise - pass ``SERVER``. - :type conn_type: ``ConnectionType`` """ def __init__( @@ -76,6 +71,16 @@ def __init__( extensions: Optional[List[Extension]] = None, trailing_data: bytes = b"", ) -> None: + """ + Constructor + + :param wsproto.connection.ConnectionType connection_type: Whether this + object is on the client- or server-side of a connection. + To initialise as a client pass ``CLIENT`` otherwise pass ``SERVER``. + :param list extensions: The proposed extensions. + :param bytes trailing_data: Data that has been received, but not yet + processed. + """ self.client = connection_type is ConnectionType.CLIENT self._events: Deque[Event] = deque() self._proto = FrameProtocol(self.client, extensions or [])