AAI SDK
    Preparing search index...

    Type Alias VoiceSessionOptions

    Options for creating a voice session — the shared field set accepted by both client() and createSessionCore. The one difference: client() defaults platformUrl from location.href, while createSessionCore requires it.

    type VoiceSessionOptions = {
        onSessionId?: (sessionId: string) => void;
        platformUrl: string;
        resumeSessionId?: string;
        WebSocket?: WebSocketConstructor;
    }
    Index
    onSessionId?: (sessionId: string) => void

    Called when the server sends a session ID in the config message. Use this to store the ID (e.g. in localStorage) for reconnection via resumeSessionId.

    Treat session IDs as sensitive: whoever holds one can resume the session and read its replayed history. They travel as a WebSocket query parameter (browsers cannot set WS headers), so they may appear in proxy and server access logs — don't put them in shared URLs.

    platformUrl: string

    Base URL of the AAI platform server.

    resumeSessionId?: string

    Session ID from a previous connection. When set, the server resumes that session if its per-session state is still within the resume grace window (SESSION_RESUME_GRACE_MS), replaying history into the new connection. Sensitive — see onSessionId.

    WebSocket constructor override. Primarily useful for testing with a mock WebSocket. When omitted, the session uses a reconnecting WebSocket (partysocket) that retries with exponential backoff after an unexpected close and resumes the session; an injected constructor is used as-is and never reconnects on its own.