File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -16,18 +16,15 @@ The full ASGI spec can be found at http://asgi.readthedocs.io
16
16
Summary
17
17
-------
18
18
19
- An ASGI application is a callable that takes a scope and returns a coroutine
20
- callable, that takes receive and send methods. It's usually written as a class :
19
+ ASGI is structured as a single asynchronous callable, which takes a dict `` scope ``
20
+ and two callables `` receive `` and `` send `` :
21
21
22
22
.. code-block :: python
23
23
24
- class Application :
25
-
26
- def __init__ (self , scope ):
27
- ...
28
-
29
- async def __call__ (self , receive , send ):
30
- ...
24
+ async def application (scope , receive , send ):
25
+ event = await receive()
26
+ ...
27
+ await send({" type" : " websocket.send" , ... })
31
28
32
29
The ``scope `` dict defines the properties of a connection, like its remote IP (for
33
30
HTTP) or username (for a chat protocol), and the lifetime of a connection.
You can’t perform that action at this time.
0 commit comments