Skip to content

Allow customizable reconnection behavior for non-persistent clients #1162

Closed

Description

@felixweinberger

Summary

The _scheduleReconnection method in StreamableHTTPClientTransport is currently private and uses setTimeout for scheduling reconnection attempts. This doesn't work well for clients that aren't running continuously (e.g., serverless functions, mobile apps that need push notifications to wake up).

Motivation

From PR #1129 review comment by @mattzcarey:

not for this PR but it would be good to be able to overwrite this method. For clients which aren't running all the time this will need some input externally from the client itself to wake it up.

Proposed Solution

Make reconnection behavior customizable, either by:

  1. Allowing _scheduleReconnection to be overridden (make it protected or provide a hook)
  2. Accepting a custom scheduler function in the transport options
  3. Emitting an event when reconnection is needed, letting the client handle scheduling

Use Cases

  • Serverless/edge functions that can't maintain long-running timers
  • Mobile apps that need to schedule reconnection via platform-specific mechanisms (push notifications, background fetch)
  • Desktop apps that need to handle sleep/wake cycles

Related

Activity

  1. added
    enhancementRequest for a new feature that's not currently supported
    good first issueGood for newcomers - can be tackled without deep knowledge of the codebase
    ready for workEnough information for someone to start working on
    P1Significant bug affecting many users, highly requested feature
    on Nov 24, 2025
  2. added a commit that references this issue on Nov 27, 2025
    307e536
  3. added
    v2Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes
    on Dec 5, 2025
  4. removed
    good first issueGood for newcomers - can be tackled without deep knowledge of the codebase
    on Dec 18, 2025
  5. self-assigned this
    on Jan 18, 2026
  6. added a commit that references this issue on Mar 25, 2026
    2d1622d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1Significant bug affecting many users, highly requested featureenhancementRequest for a new feature that's not currently supportedready for workEnough information for someone to start working onv2Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions