Skip to content

Types API

types

Core data types and interface protocols for the library.

ConnectionState

Enumeration of connection states.

EventType

Enumeration of system event types.

SessionProtocol

Define the essential interface of a WebTransport session.

headers property

headers: Headers

Return the session headers.

path property

path: str

Return the session path.

remote_address property

remote_address: Address | None

Return the remote address of the peer.

session_id property

session_id: SessionId

Return the session ID.

state property

state: SessionState

Return the current session state.

wt_available_protocols property

wt_available_protocols: list[str] | None

Return the requested wt_available_protocols.

wt_protocol property writable

wt_protocol: str | None

Return the negotiated wt_protocol.

close async

close(*, error_code: int = 0, reason: str | None = None) -> None

Terminate the session.

SessionState

Enumeration of WebTransport session states.

StreamDirection

Enumeration of stream directions.

StreamState

Enumeration of WebTransport stream states.

WebTransportProtocol

Define the interface for the underlying WebTransport layer.

connection_lost

connection_lost(exc: Exception | None) -> None

Handle connection loss.

connection_made

connection_made(transport: BaseTransport) -> None

Handle connection establishment.

datagram_received

datagram_received(data: Buffer, addr: Address) -> None

Handle incoming datagrams.

error_received

error_received(exc: Exception) -> None

Handle incoming transport errors.