Skip to content

Commit 9ea9f88

Browse files
committed
Add new asyncio-based implementation.
1 parent add86fb commit 9ea9f88

18 files changed

+2977
-20
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ tests:
1717
python -m unittest
1818

1919
coverage:
20-
coverage run --source src/websockets,tests -m unittest
20+
coverage run --source src/websockets,tests -m unittest tests/asyncio/test_*.py
2121
coverage html
2222
coverage report --show-missing --fail-under=100
2323

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

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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:: ping
31+
32+
.. automethod:: pong
33+
34+
WebSocket connection objects also provide these attributes:
35+
36+
.. autoattribute:: id
37+
38+
.. autoattribute:: logger
39+
40+
.. autoproperty:: local_address
41+
42+
.. autoproperty:: remote_address
43+
44+
The following attributes are available after the opening handshake,
45+
once the WebSocket connection is open:
46+
47+
.. autoattribute:: request
48+
49+
.. autoattribute:: response
50+
51+
.. autoproperty:: subprotocol

docs/reference/new-asyncio/common.rst

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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:: ping
21+
22+
.. automethod:: pong
23+
24+
WebSocket connection objects also provide these attributes:
25+
26+
.. autoattribute:: id
27+
28+
.. autoattribute:: logger
29+
30+
.. autoproperty:: local_address
31+
32+
.. autoproperty:: remote_address
33+
34+
The following attributes are available after the opening handshake,
35+
once the WebSocket connection is open:
36+
37+
.. autoattribute:: request
38+
39+
.. autoattribute:: response
40+
41+
.. autoproperty:: subprotocol

docs/reference/new-asyncio/server.rst

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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:: serve_forever
21+
22+
.. .. automethod:: shutdown
23+
24+
.. .. automethod:: fileno
25+
26+
Using a connection
27+
------------------
28+
29+
.. autoclass:: ServerConnection
30+
31+
.. automethod:: __aiter__
32+
33+
.. automethod:: recv
34+
35+
.. automethod:: recv_streaming
36+
37+
.. automethod:: send
38+
39+
.. automethod:: close
40+
41+
.. automethod:: ping
42+
43+
.. automethod:: pong
44+
45+
WebSocket connection objects also provide these attributes:
46+
47+
.. autoattribute:: id
48+
49+
.. autoattribute:: logger
50+
51+
.. autoproperty:: local_address
52+
53+
.. autoproperty:: remote_address
54+
55+
The following attributes are available after the opening handshake,
56+
once the WebSocket connection is open:
57+
58+
.. autoattribute:: request
59+
60+
.. autoattribute:: response
61+
62+
.. autoproperty:: subprotocol

0 commit comments

Comments
 (0)