Asynchronous Server Gateway Interface
Version | 3.0 |
---|---|
Developer | ASGI Team |
Release date | 2019-03-04[1] |
Website | asgi |
License | public domain[2] |
Status | Draft |
The Asynchronous Server Gateway Interface (ASGI) is a calling convention for web servers to forward requests to asynchronous-capable Python programming language frameworks, and applications. It is built as a successor to the Web Server Gateway Interface (WSGI).
Where WSGI provided a standard for synchronous Python application, ASGI provides one for both asynchronous and synchronous applications, with a WSGI backwards-compatibility implementation and multiple servers and application frameworks.
Asynchronous Server Gateway Interface (ASGI) servers
Below listed some complete or upcoming implementations of Asynchronous Server Gateway Interface (ASGI Specification) - web servers and frameworks.
Daphne
Daphne is a Hypertext Transfer Protocol, HTTP2 and WebSocket protocol server for ASGI and ASGI-HTTP, developed to power Django (web framework) Channels. It supports automatic negotiation of protocols; there's no need for URL prefixing to determine WebSocket endpoints versus HTTP endpoints.[3]
Uvicorn
Uvicorn is an ASGI web server implementation for Python (programming language). Uvicorn currently supports HTTP/1.1 and WebSockets.[4]
NGINX Unit
NGINX Unit is an ASGI web server implementation for Python (programming language). NGINX Unit currently supports HTTP/1.1 and WebSockets.[5]
Hypercorn
Hypercorn is an ASGI and WSGI web server based on the sans-io hyper, h11, h2, and wsproto libraries and inspired by Gunicorn. Hypercorn supports HTTP/1, HTTP/2, WebSockets (over HTTP/1 and HTTP/2), ASGI, and WSGI specifications. Hypercorn can utilise asyncio, uvloop, or trio worker types.[6]
Asynchronous Server Gateway Interface (ASGI) frameworks
FastAPI
FastAPI is an ASGI web framework for building RESTful APIs based on standards like OpenAPI, JSON Schema, and OAuth2. FastAPI supports HTTP and WebSockets.
Django Channels
Channels is an ASGI web framework that extends Django capabilities. It supports HTTP, WebSockets.
Web Server Gateway Interface (WSGI) compatibility
ASGI is also designed to be a superset of WSGI, and there's a defined way of translating between the two, allowing WSGI applications to be run inside ASGI servers through a translation wrapper (provided in the asgiref library). A threadpool can be used to run the synchronous WSGI applications away from the async event loop.
See also
- Comparison of web frameworks
- FastCGI
- Python (programming language)
- Web Server Gateway Interface (WSGI)
References
- ^ "Version History".
- ^ "Copyright". Retrieved 2022-09-14.
- ^ "Daphne Website". Retrieved 2022-09-14.
- ^ "Uvicorn Website". Retrieved 2022-09-14.
- ^ "NGINX Unit for Python". Retrieved 2023-05-02.
- ^ "Hypercorn Website". Retrieved 2022-09-14.