Asynchronous Server Gateway Interface (ASGI)
Jump to navigation
Jump to search
A Asynchronous Server Gateway Interface (ASGI) is a Python specification for asynchronous web servers and asynchronous applications.
- Context:
- It can provide a standard interface between async-capable Python web servers, frameworks, and applications.
- It can allow the handling of multiple, asynchronous events per application.
- It can support both synchronous and asynchronous applications, offering backward compatibility with WSGI.
- It can use a single asynchronous callable, which takes a `dict` `scope` and two callables `receive` and `send`.
- It can define the properties of a connection and the lifetime of a connection through the `scope` dict.
- It can provide events as dicts through the `receive` awaitable and sends events back to the client through the `send` awaitable in a similar dict format.
- It can have middleware that plays the role of both server and application, taking in a `scope` and the `send`/`receive` awaitables, potentially modifying them, and then calling an inner application.
- It can include protocol specifications that describe the standardized scope and message formats for various protocols, such as HTTP and WebSocket.
- ...
- Example(s):
- as used in web frameworks like Starlette and FastAPI.
- as implemented in Channels ____ and Daphne ____.
- ...
- Counter-Example(s):
- See: asyncio, aiohttp, Public Domain, GitHub, Web Server, Asynchronous Method Invocation, Python (Programming Language).
References
2024
- (Wikipedia, 2024) ⇒ https://en.wikipedia.org/wiki/Asynchronous_Server_Gateway_Interface Retrieved:2024-1-25.
- 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.
- 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).