Skip to content

Commit 2abd24c

Browse files
MtkN1Kriechi
authored andcommitted
Add wsproto.Connection reference
1 parent 9423fc0 commit 2abd24c

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

docs/source/api.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Connection
1919
:special-members: __init__
2020
:members:
2121

22+
.. autoclass:: wsproto.Connection
23+
:special-members: __init__
24+
:members:
25+
2226
.. autoclass:: wsproto.ConnectionType
2327
:members:
2428

src/wsproto/connection.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ class Connection:
6363
This wraps two other protocol objects, an HTTP/1.1 protocol object used
6464
to do the initial HTTP upgrade handshake and a WebSocket frame protocol
6565
object used to exchange messages and other control frames.
66-
67-
:param conn_type: Whether this object is on the client- or server-side of
68-
a connection. To initialise as a client pass ``CLIENT`` otherwise
69-
pass ``SERVER``.
70-
:type conn_type: ``ConnectionType``
7166
"""
7267

7368
def __init__(
@@ -76,6 +71,16 @@ def __init__(
7671
extensions: Optional[List[Extension]] = None,
7772
trailing_data: bytes = b"",
7873
) -> None:
74+
"""
75+
Constructor
76+
77+
:param wsproto.connection.ConnectionType connection_type: Whether this
78+
object is on the client- or server-side of a connection.
79+
To initialise as a client pass ``CLIENT`` otherwise pass ``SERVER``.
80+
:param list extensions: The proposed extensions.
81+
:param bytes trailing_data: Data that has been received, but not yet
82+
processed.
83+
"""
7984
self.client = connection_type is ConnectionType.CLIENT
8085
self._events: Deque[Event] = deque()
8186
self._proto = FrameProtocol(self.client, extensions or [])

0 commit comments

Comments
 (0)