本文へスキップ
hdknr blog
戻る

Django: asgiref

asgiref

ASGI:

This package includes ASGI base libraries, such as:

Function wrappers

These allow you to wrap or decorate async or sync functions to call them from the other style (so you can call async functions from a synchronous thread, or vice-versa).

In particular:

Easy to Call:

Note:

Threadlocal replacement

asgiref.local:

記事:

Server base classes

Includes a StatelessServer class which provides all the hard work of writing a stateless server (as in, does not handle direct incoming sockets but instead consumes external streams or sockets to work out what is happening).

An example of such a server would be a chatbot server that connects out to a central chat server and provides a “connection scope” per user chatting to it. There’s only one actual connection, but the server has to separate things into several scopes for easier writing of the code.

You can see an example of this being used in frequensgi.

WSGI-to-ASGI adapter



前の記事
Python: singledispatch
次の記事
AWS: ECS