Skip to main content

get_websocket_app

Creates and returns an asynchronous WebSocket application function that handles dependency injection, validation, and execution for a specific endpoint.

def get_websocket_app(
dependant: Dependant,
dependency_overrides_provider: Any | null = null,
embed_body_fields: bool = false
) - > Callable[[WebSocket], Coroutine[Any, Any, Any]]

Creates and returns an asynchronous WebSocket application handler that manages dependency injection and validation for a specific endpoint.

Parameters

NameTypeDescription
dependantDependantThe dependency model containing the endpoint function and its required parameters.
dependency_overrides_provider`Anynull` = null
embed_body_fieldsbool = falseDetermines whether to treat multiple body parameters as fields within a single JSON object.

Returns

TypeDescription
Callable[[WebSocket], Coroutine[Any, Any, Any]]An asynchronous function that processes a WebSocket connection, resolves its dependencies, and executes the underlying endpoint logic.