Skip to content

Commit ed1f2a9

Browse files
committed
Add new asyncio-based implementation.
1 parent b04d272 commit ed1f2a9

15 files changed

+4119
-4
lines changed

docs/reference/index.rst

+12
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ clients concurrently.
2626
asyncio/server
2727
asyncio/client
2828

29+
:mod:`asyncio` (new)
30+
--------------------
31+
32+
This is a rewrite of the :mod:`asyncio` implementation. It will become the
33+
default implementation.
34+
35+
.. toctree::
36+
:titlesonly:
37+
38+
new-asyncio/server
39+
new-asyncio/client
40+
2941
:mod:`threading`
3042
----------------
3143

docs/reference/new-asyncio/client.rst

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Client (:mod:`asyncio` - new)
2+
=============================
3+
4+
.. automodule:: websockets.asyncio.client
5+
6+
Opening a connection
7+
--------------------
8+
9+
.. autofunction:: connect
10+
:async:
11+
12+
.. autofunction:: unix_connect
13+
:async:
14+
15+
Using a connection
16+
------------------
17+
18+
.. autoclass:: ClientConnection
19+
20+
.. automethod:: __aiter__
21+
22+
.. automethod:: recv
23+
24+
.. automethod:: recv_streaming
25+
26+
.. automethod:: send
27+
28+
.. automethod:: close
29+
30+
.. automethod:: wait_closed
31+
32+
.. automethod:: ping
33+
34+
.. automethod:: pong
35+
36+
WebSocket connection objects also provide these attributes:
37+
38+
.. autoattribute:: id
39+
40+
.. autoattribute:: logger
41+
42+
.. autoproperty:: local_address
43+
44+
.. autoproperty:: remote_address
45+
46+
The following attributes are available after the opening handshake,
47+
once the WebSocket connection is open:
48+
49+
.. autoattribute:: request
50+
51+
.. autoattribute:: response
52+
53+
.. autoproperty:: subprotocol

docs/reference/new-asyncio/common.rst

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
:orphan:
2+
3+
Both sides (:mod:`asyncio` - new)
4+
=================================
5+
6+
.. automodule:: websockets.asyncio.connection
7+
8+
.. autoclass:: Connection
9+
10+
.. automethod:: __aiter__
11+
12+
.. automethod:: recv
13+
14+
.. automethod:: recv_streaming
15+
16+
.. automethod:: send
17+
18+
.. automethod:: close
19+
20+
.. automethod:: wait_closed
21+
22+
.. automethod:: ping
23+
24+
.. automethod:: pong
25+
26+
WebSocket connection objects also provide these attributes:
27+
28+
.. autoattribute:: id
29+
30+
.. autoattribute:: logger
31+
32+
.. autoproperty:: local_address
33+
34+
.. autoproperty:: remote_address
35+
36+
The following attributes are available after the opening handshake,
37+
once the WebSocket connection is open:
38+
39+
.. autoattribute:: request
40+
41+
.. autoattribute:: response
42+
43+
.. autoproperty:: subprotocol

docs/reference/new-asyncio/server.rst

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
Server (:mod:`asyncio` - new)
2+
=============================
3+
4+
.. automodule:: websockets.asyncio.server
5+
6+
Creating a server
7+
-----------------
8+
9+
.. autofunction:: serve
10+
:async:
11+
12+
.. autofunction:: unix_serve
13+
:async:
14+
15+
Running a server
16+
----------------
17+
18+
.. autoclass:: WebSocketServer
19+
20+
.. automethod:: close
21+
22+
.. automethod:: wait_closed
23+
24+
.. automethod:: get_loop
25+
26+
.. automethod:: is_serving
27+
28+
.. automethod:: start_serving
29+
30+
.. automethod:: serve_forever
31+
32+
.. autoattribute:: sockets
33+
34+
Using a connection
35+
------------------
36+
37+
.. autoclass:: ServerConnection
38+
39+
.. automethod:: __aiter__
40+
41+
.. automethod:: recv
42+
43+
.. automethod:: recv_streaming
44+
45+
.. automethod:: send
46+
47+
.. automethod:: close
48+
49+
.. automethod:: wait_closed
50+
51+
.. automethod:: ping
52+
53+
.. automethod:: pong
54+
55+
WebSocket connection objects also provide these attributes:
56+
57+
.. autoattribute:: id
58+
59+
.. autoattribute:: logger
60+
61+
.. autoproperty:: local_address
62+
63+
.. autoproperty:: remote_address
64+
65+
The following attributes are available after the opening handshake,
66+
once the WebSocket connection is open:
67+
68+
.. autoattribute:: request
69+
70+
.. autoattribute:: response
71+
72+
.. autoproperty:: subprotocol

0 commit comments

Comments
 (0)