ASGI applications and aliases¶
These aliases in h2corn.types describe the callable boundary between an ASGI application and h2corn. Application accepts either the precise ASGIApp contract or the broader mutable-mapping annotations used by framework applications.
FrameworkASGIAppmodule-attribute¶
FrameworkASGIApp = Callable[
[MutableMapping[str, Any], FrameworkReceive, FrameworkSend], Awaitable[None]
]
Applicationmodule-attribute¶
Application = ASGIApp | FrameworkASGIApp
ApplicationFactorymodule-attribute¶
ApplicationFactory = Callable[[], Application]
Receivemodule-attribute¶
Receive = Callable[[], Awaitable[ReceiveMessage]]
Sendmodule-attribute¶
Send = Callable[[SendMessage], Awaitable[None]]
Scopemodule-attribute¶
Scope = HTTPScope | WebSocketScope | LifespanScope
ReceiveMessagemodule-attribute¶
ReceiveMessage = (
HTTPRequest
| HTTPDisconnect
| WebSocketConnect
| WebSocketReceiveBytes
| WebSocketReceiveText
| WebSocketDisconnect
| LifespanStartup
| LifespanShutdown
)
SendMessagemodule-attribute¶
SendMessage = (
HTTPResponseStart
| HTTPResponseBody
| HTTPResponseTrailers
| HTTPResponsePathsend
| HTTPResponseZeroCopySend
| HTTPResponseEarlyHint
| WebSocketAccept
| WebSocketSendBytes
| WebSocketSendText
| WebSocketClose
| WebSocketHTTPResponseStart
| WebSocketHTTPResponseBody
| LifespanStartupComplete
| LifespanStartupFailed
| LifespanShutdownComplete
| LifespanShutdownFailed
)
Messagemodule-attribute¶
Message = ReceiveMessage | SendMessage