endpoints icon indicating copy to clipboard operation
endpoints copied to clipboard

ASGI interface module

Open Jaymon opened this issue 2 years ago • 3 comments

From the docs:

ASGI (Asynchronous Server Gateway Interface) is a spiritual successor to WSGI, intended to provide a standard interface between async-capable Python web servers, frameworks, and applications.

Heard about this from here:

If you are starting a new project, you might benefit from a newer and faster framework based on ASGI instead of WSGI (Flask and Django are WSGI-based).

...Also, if you want to use new technologies like WebSockets it would be easier (and possible) with a newer framework based on ASGI, like FastAPI or Starlette. As the standard ASGI was designed to be able to handle asynchronous code like the one needed for WebSockets.

Check out Starlette, Uvicorn, or FastAPI to see how it is implemented. It looks like FastAPI depends on Starlette, and Starlette is using Anyio as an underlying library. This module: asgiref also looks useful.

The current reference server is Daphne:

The current ASGI reference server, written in Twisted and maintained as part of the Django Channels project. Supports HTTP/1, HTTP/2, and WebSockets.

Jaymon avatar Aug 13 '21 22:08 Jaymon