MCP TypeScript SDK (V2)
    Preparing search index...
    ReconnectionScheduler: (
        reconnect: () => void,
        delay: number,
        attemptCount: number,
    ) => (() => void) | void

    Custom scheduler for SSE stream reconnection attempts.

    Called instead of setTimeout when the transport needs to schedule a reconnection. Useful in environments where setTimeout is unsuitable (serverless functions that terminate before the timer fires, mobile apps that need platform background scheduling, desktop apps handling sleep/wake).

    Type Declaration

      • (
            reconnect: () => void,
            delay: number,
            attemptCount: number,
        ): (() => void) | void
      • Parameters

        • reconnect: () => void

          Call this to perform the reconnection attempt.

        • delay: number

          Suggested delay in milliseconds (from backoff calculation).

        • attemptCount: number

          Zero-indexed retry attempt number.

        Returns (() => void) | void

        An optional cancel function. If returned, it will be called on transport.close() to abort the pending reconnection.

    const scheduler: ReconnectionScheduler = (reconnect, delay) => {
    const id = platformBackgroundTask.schedule(reconnect, delay);
    return () => platformBackgroundTask.cancel(id);
    };