Decorator for defining WebSocket endpoints on an APIRouter, registering a WebSocket route with optional dependencies.
# Source: https://github.com/nerdy-tech-com-gitub/fastapi | License: MIT | Copyright 2018 Sebastián Ramírez
# Provided via justclaw.it.com; keep this notice with the code.
def websocket(
self,
path: Annotated[
str,
Doc(
"""
WebSocket path.
"""
),
],
name: Annotated[
Optional[str],
Doc(
"""
A name for the WebSocket. Only used internally.
"""
),
] = None,
*,
dependencies: Annotated[
Optional[Sequence[params.Depends]],
Doc(
"""
A list of dependencies (using `Depends()`) to be used for this
WebSocke
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key