AIRI Server API - v0.10.2
    Preparing search index...
    • Creates the H3 websocket application and its in-memory peer registry.

      Sets up a complete websocket server with:

      • Peer authentication and lifecycle management
      • Module registration and discovery (registry sync)
      • Consumer-based event routing for load distribution
      • Health checking with automatic peer removal on timeout
      • Event routing with optional policy-based filtering
      • Heartbeat monitoring for liveness detection

      Use when:

      • Embedding the AIRI websocket runtime inside a server process
      • Spinning up a testable application instance before binding a socket listener

      Expects:

      • Caller lifecycle management to invoke dispose when the app is no longer needed
      • Auth token (if provided) must be validated for all clients
      • Routing middleware should be stateless and idempotent

      Returns:

      • The H3 app at /ws endpoint plus cleanup helpers for peer shutdown and timer disposal

      Ownership:

      • Manages peer registry and module registry as internal mutable state
      • Owns all timers and intervals created during setup
      • Consumer orchestrator state is isolated within this function scope

      Parameters

      Returns {
          app: H3$1;
          closeAllPeers: () => void;
          dispose: () => void;
          getHealthCheck: () => {
              status: "healthy"
              | "degraded";
              instanceId: string;
              uptimeSeconds: number;
              health: { checkIntervalMs: number; heartbeatTtlMs: number };
              peers: { total: number; healthy: number; unhealthy: number };
              modules: { total: number };
          };
          metrics: MetricRegistry;
      }

      • app: H3$1
      • closeAllPeers: () => void
      • dispose: () => void
      • getHealthCheck: () => {
            status: "healthy"
            | "degraded";
            instanceId: string;
            uptimeSeconds: number;
            health: { checkIntervalMs: number; heartbeatTtlMs: number };
            peers: { total: number; healthy: number; unhealthy: number };
            modules: { total: number };
        }
      • metrics: MetricRegistry

        Self-contained Prometheus-compatible metric registry tracking server-level observables (peer counts, module totals). Register external instruments via registry.register(...) and scrape via registry.expose().