AAI SDK
    Preparing search index...

    Function useSession

    • Return the live Session: the current snapshot fields plus the control methods (start, toggle, reset, resetState, disconnect, cancel, end).

      Throws if used outside the provider client() installs (the error names <SessionProvider> — you only mount that yourself when bypassing client()). Re-renders the component on every snapshot change; for a component that reads one field, prefer useSessionSelector for a targeted subscription.

      Returns Session

      import { useSession } from "@alexkroman1/aai-ui";

      function Controls() {
      const session = useSession();
      if (!session.started) return <button onClick={session.start}>Start</button>;
      return <button onClick={session.toggle}>{session.running ? "Pause" : "Resume"}</button>;
      }