@dvxch/yandex-music
    Preparing search index...

    Interface RealtimeOptions

    Options for RealtimeClient.

    interface RealtimeOptions {
        deviceId?: string;
        deviceInfo?: DeviceInfoOverride | null;
        goAwayMaxMs?: number;
        reconnect?: boolean;
        reconnectBaseMs?: number;
        reconnectMaxMs?: number;
        resolveTrack?: (playableId: string) => Promise<Track | null>;
        staleTimeoutMs?: number;
        token: string;
    }
    Index

    Properties

    deviceId?: string

    Device id. Defaults to a random id generated once and reused across every reconnect. Keeping it stable matters: Ynison deduplicates broadcast by device, so a fresh id per reconnect makes the server drop this observer from the fan-out and the state goes stale.

    deviceInfo?: DeviceInfoOverride | null

    Device identity override (defaults to a web SDK identity).

    goAwayMaxMs?: number

    Maximum delay (ms) to honour from a server "go-away" frame before retrying. Defaults to 60000. Ynison sometimes answers "temporary unavailable" with a go-away of an hour or more; capping it lets a watcher recover within a minute of the service returning instead of staying dead for the full hour, while a single retry per cap interval is gentle enough not to hammer the server.

    reconnect?: boolean

    Whether to reconnect automatically. Defaults to true.

    reconnectBaseMs?: number

    Initial reconnect backoff in ms. Defaults to 1000.

    reconnectMaxMs?: number

    Maximum reconnect backoff in ms. Defaults to 30000.

    resolveTrack?: (playableId: string) => Promise<Track | null>

    Optional resolver mapping a playable id to a Track for trackChange.

    staleTimeoutMs?: number

    Force a reconnect when the WebSocket shows no activity — no frame, ping or pong — for this many ms, which means a silently broken pipe with no TCP reset. 0 (the default) disables the watchdog. A now-playing watcher typically sets this to ~120000.

    This watches transport liveness (kept fresh by the ~20s keep-alive ping/pong), not state-frame arrival: Ynison only pushes a state frame on an actual state change, so a paused or idle player is legitimately silent for minutes while the connection is perfectly healthy. Tearing such a connection down on state-frame silence triggers a reconnect storm that the server answers with rate-limiting and host rebalancing.

    token: string

    OAuth token.