Skip to main content

get_websocket_app

No overview available.

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

Creates and returns an asynchronous WebSocket application function that handles incoming WebSocket connections. This function is responsible for solving dependencies, validating input, and executing the provided dependant's call function for WebSocket communication.

Parameters

NameTypeDescription
dependantDependantThe Dependant object containing information about the WebSocket endpoint, including its callable function and path.
dependency_overrides_provider`AnyNone` = None
embed_body_fieldsbool = FalseA boolean indicating whether body fields should be embedded during dependency resolution. This is typically used for request bodies, but can apply to WebSocket messages if they are structured like request bodies.

Returns

TypeDescription
Callable[[WebSocket], Coroutine[Any, Any, Any]]An asynchronous function that takes a WebSocket object and returns a Coroutine, representing the WebSocket application.