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 function (coroutine) that will be executed for each WebSocket session. This function receives a WebSocket object as its sole argument. |
Returns
| Type | Description |
|---|---|
ASGIApp | An ASGI application that can handle WebSocket connections. |