Core Concepts

Updated Dec 08, 2025
  • WebSocketRouter – Mountable Falcon resource that owns route definitions and orchestrates instantiation.
  • WebSocketResource – Per-connection handler exposing lifecycle hooks (on_connect, on_disconnect) and message handlers.
  • Composable hierarchy – Resources can register child routes with add_subroute, passing context and shared state down the chain.
  • Schema-driven dispatch – Define a msgspec tagged union schema and register handlers with @handles_message("tag") (preferred) or on_tag method names.
  • Connection managerWebSocketConnectionManager tracks active sockets, rooms, and supports pluggable backends.
  • Workers – ASGI lifespan-friendly background tasks coordinated by WorkerController.