websocket_session
Takes a coroutine func(session), and returns an ASGI application.
def websocket_session(
func: Callable[[WebSocket], Awaitable[None]]
) - > ASGIApp
Takes a coroutine func(session), and returns an ASGI application.
Parameters
| Name | Type | Description |
|---|---|---|
| func | Callable[[WebSocket], Awaitable[None]] | The asynchronous handler function that receives a WebSocket session instance and contains the logic for the connection. |
Returns
| Type | Description |
|---|---|
ASGIApp | An ASGI application that wraps the provided coroutine and manages the WebSocket lifecycle and exception handling. |