D-ID Client SDK - v3.0.0-0
    Preparing search index...

    Enumeration StreamEndReason

    Why the server ended the session.

    Arrives as the reason argument of onConnectionStateChange together with 'disconnected', and is how you tell a session the server closed on purpose from a connection that simply dropped — reason is an opaque transport diagnostic in the latter case, so compare it against these values rather than parsing it. A close reason the SDK does not recognize is forwarded as-is, which is the other reason to compare against the enum. Which members can arrive depends on the agent type: Talks (V2) and Clips (V3) agents report only Ok, UnknownError, NetworkIssue and Inactivity. reconnect() still works afterwards; it starts a new stream rather than resuming the ended one.

    import { ConnectionState, StreamEndReason, type AgentManagerCallbacks } from '@d-id/client-sdk';

    const callbacks: AgentManagerCallbacks = {
    onConnectionStateChange(state, reason) {
    if (state !== ConnectionState.Disconnected) return;

    if (reason === StreamEndReason.TimeLimit || reason === StreamEndReason.MessageLimit) {
    showMessage('This session has reached its limit.');
    } else if (reason === StreamEndReason.Inactivity) {
    showMessage('The session timed out.');
    }
    },
    };
    Index
    EndedByAgent: "ended_by_agent"

    The agent itself ended the call.

    Expressive (V4) agents.

    Inactivity: "inactivity"

    The session ended because nothing happened for too long.

    The window is sessionTimeout for Talks (V2) and Clips (V3).

    MessageLimit: "message_limit"

    The session ended because it reached the message limit configured for the agent.

    Expressive (V4) agents.

    NetworkIssue: "network_issue"

    The session ended because the connection to the browser broke down.

    Ok: "ok"

    The session ended normally, because it was closed deliberately.

    TimeLimit: "time_limit"

    The session ended because it reached its maximum duration.

    Expressive (V4) agents.

    UnknownError: "unknown_error"

    The session ended because of a failure the server could not classify.