Framework API¶
framework
¶
Application framework for WebTransport services.
ServerApp
¶
Implement a high-level WebTransport application with routing and middleware.
add_middleware
¶
Add a middleware to the processing chain.
middleware
¶
Register a middleware function.
pattern_route
¶
Register a session handler for a URL pattern.
route
¶
Register a session handler for a specific path.
run
¶
Execute the server application in a new asyncio event loop.
serve
async
¶
Start the server and listen for connections indefinitely.
AuthHandlerProtocol
¶
Define the authentication handler interface.
MiddlewareManager
¶
MiddlewareProtocol
¶
Define the middleware interface.
MiddlewareRejected
¶
Indicate a session request rejection by middleware.
StatefulMiddlewareProtocol
¶
Define the stateful middleware interface.
RequestRouter
¶
Route session requests to handlers based on path matching.
add_pattern_route
¶
Register a route for a regular expression pattern.
add_route
¶
Register a route for an exact path match.
get_all_routes
¶
Return a copy of all registered exact-match routes.
get_route_handler
¶
Return the handler for a specific path (exact match only).
get_route_stats
¶
Return statistics about the configured routes.
remove_pattern_route
¶
Unregister a route for a regular expression pattern.
route_request
¶
Dispatch a request to the appropriate handler based on the session path.
set_default_handler
¶
Configure a default handler for unmatched routes.
create_auth_middleware
¶
Instantiate authentication middleware with a custom handler.
create_cors_middleware
¶
Instantiate CORS middleware to validate the Origin header.
create_rate_limit_middleware
¶
create_rate_limit_middleware(*, max_requests: int = _WINDOW_REQUEST_LIMIT, window_seconds: int = _WINDOW_TTL, cleanup_interval: int = _CLEANUP_INTERVAL, max_tracked_ips: int = _TRACKED_IP_CAPACITY) -> RateLimiter
Instantiate a stateful rate-limiting middleware.