@@ -10,14 +10,14 @@ It provides a very similar API. However, there are a few differences.
10
10
11
11
The recommended upgrade process is:
12
12
13
- #. Make sure that your application doesn't use any `deprecated APIs `_. If it
14
- doesn't raise any warnings, you can skip this step .
15
- #. `Update import paths `_. For straightforward usage of websockets , this could
16
- be the only step you need to take. Upgrading could be transparent .
17
- #. Check out `new features and improvements `_ and consider taking advantage of
18
- them to improve your application .
19
- #. Review `API changes `_ and adapt your application to preserve its current
20
- functionality .
13
+ #. Make sure that your code doesn't use any `deprecated APIs `_. If it doesn't
14
+ raise warnings, you're fine .
15
+ #. `Update import paths `_. For straightforward use cases , this could be the only
16
+ step you need to take.
17
+ #. Check out `new features and improvements `_. Consider taking advantage of them
18
+ in your code .
19
+ #. Review `API changes `_. If needed, update your application to preserve its
20
+ current behavior .
21
21
22
22
In the interest of brevity, only :func: `~asyncio.client.connect ` and
23
23
:func: `~asyncio.server.serve ` are discussed below but everything also applies
@@ -146,9 +146,8 @@ Customizing the opening handshake
146
146
.................................
147
147
148
148
On the server side, if you're customizing how :func: `~legacy.server.serve `
149
- processes the opening handshake with the ``process_request ``, ``extra_headers ``,
150
- or ``select_subprotocol ``, you must update your code and you can probably make
151
- it simpler.
149
+ processes the opening handshake with ``process_request ``, ``extra_headers ``, or
150
+ ``select_subprotocol ``, you must update your code. Probably you can simplify it!
152
151
153
152
``process_request `` and ``select_subprotocol `` have new signatures.
154
153
``process_response `` replaces ``extra_headers `` and provides more flexibility.
@@ -481,16 +480,17 @@ a ``check_credentials`` coroutine as well as an optional ``realm`` just like
481
480
This new API has more obvious semantics. That makes it easier to understand and
482
481
also easier to extend.
483
482
484
- In the original implementation, overriding ``create_protocol `` changed the type
483
+ In the original implementation, overriding ``create_protocol `` changes the type
485
484
of connection objects to :class: `~legacy.auth.BasicAuthWebSocketServerProtocol `,
486
485
a subclass of :class: `~legacy.server.WebSocketServerProtocol ` that performs HTTP
487
- Basic Authentication in its ``process_request `` method. If you wanted to
488
- customize ``process_request `` further, you had:
486
+ Basic Authentication in its ``process_request `` method.
489
487
490
- * an ill-defined option: add a ``process_request `` argument to
488
+ To customize ``process_request `` further, you had only bad options:
489
+
490
+ * the ill-defined option: add a ``process_request `` argument to
491
491
:func: `~legacy.server.serve `; to tell which one would run first, you had to
492
492
experiment or read the code;
493
- * a cumbersome option: subclass
493
+ * the cumbersome option: subclass
494
494
:class: `~legacy.auth.BasicAuthWebSocketServerProtocol `, then pass that
495
495
subclass in the ``create_protocol `` argument of
496
496
:func: `~legacy.auth.basic_auth_protocol_factory `.
0 commit comments