Skip to content

Server API

server

Core server implementation for accepting WebTransport connections.

ServerDiagnostics dataclass

Encapsulate a snapshot of server health.

issues property

issues: list[str]

Return a list of potential issues based on the current diagnostics.

ServerStats dataclass

Encapsulate server statistics.

success_rate property

success_rate: float

Return the connection success rate.

total_connections_attempted property

total_connections_attempted: int

Return the total number of connections attempted.

to_dict

to_dict() -> dict[str, Any]

Convert statistics to a dictionary.

WebTransportServer

Manage the lifecycle and connections for the WebTransport server.

config property

config: ServerConfig

Return the server's configuration object.

connection_manager property

connection_manager: ConnectionManager

Return the server's connection manager instance.

is_serving property

is_serving: bool

Return True if the server is currently serving.

local_addresses property

local_addresses: list[Address]

Return the local addresses the server is bound to.

session_manager property

session_manager: SessionManager

Return the server's session manager instance.

close async

close() -> None

Gracefully shut down the server and its resources.

diagnostics async

diagnostics() -> ServerDiagnostics

Retrieve a snapshot of the server's diagnostics and statistics.

listen async

listen(*, host: str | None = None, port: int | None = None) -> None

Start the server and begin listening for connections.

serve_forever async

serve_forever() -> None

Run the server indefinitely until interrupted.