Skip to content

[Feature Request] Decouple proxied session lifetime from transport carrier lifetime #7097

Closed as not planned

Description

@anonymously-hidden

Could Xray-core support a persistent logical proxied session whose lifetime is independent of its underlying transport connection?

Currently, when an XHTTP/H2/WS carrier is terminated, the failure ultimately propagates to the proxied TCP connection. For long-lived stateful connections (e.g. games, SSH), reconnecting the carrier therefore also terminates the application connection.

The desired architecture is:

Application TCP
      │
      ▼
Persistent logical session
      │
   ┌──┴──────────┐
   │             │
Carrier #1    Carrier #2
   X             │
                 ▼
              resume

If a carrier dies, the logical session remains alive, a new carrier attaches to the same session, and any necessary state/data is resumed or retransmitted. The application-facing TCP connection should not see EOF merely because its transport carrier changed.

This would be a more general primitive than XHTTP-specific stream resume and could potentially be used by XHTTP, WS, Mux, etc.

There have already been several related discussions:

My use case is specifically long-lived game TCP connections where DPI/CDN/network infrastructure can terminate the XHTTP/H2 carrier. Certificate interception is not an option because some games use certificate pinning, so the application's existing TCP/TLS connection needs to remain completely untouched.

Is a transport-independent persistent-session / carrier-migration layer something that could fit Xray-core's architecture?

Activity

  1. Fangliding commented on Oct 6, 2026

    @Fangliding
    Member

    技术上是做不到的 要这种东西必须依赖某种ACK机制

  2. anonymously-hidden commented on Oct 6, 2026

    @anonymously-hidden
    ContributorAuthor

    Technically, it's impossible; such a thing requires some kind of ACK mechanism.

    Yes, I agree. I don't mean simply attaching a new carrier to the existing stream without any additional state.

    What I'm proposing is a carrier-independent session layer with its own sequence/ACK state and retransmission buffer, so that after a carrier failure the new carrier can resume the same logical stream from the last acknowledged byte.

    In other words, the transport carrier would become replaceable, while the proxied TCP session remains persistent. QUIC already provides this kind of reliability/migration machinery; the question is whether a similar, minimal mechanism could be implemented above transports such as XHTTP/H2 for cases where H3 is unavailable.

  3. Fangliding commented on Oct 6, 2026

    @Fangliding
    Member

    实现它要考虑的复杂情况很多 而收益有限 绝大多数应用有成熟的重连逻辑以应对复杂的网络情况

  4. anonymously-hidden commented on Oct 6, 2026

    @anonymously-hidden
    ContributorAuthor

    I understand the concern about the complexity, and I agree that most applications can handle ordinary connection failures with their own reconnection logic.

    But I think there is an important distinction between reconnecting an application and preserving an existing TCP session.

    For example, with SSH, a database connection, a long-running upload/download, or any stateful protocol, application-level reconnection can mean losing the existing session/state even if the underlying network interruption only lasts a few seconds. In those cases, the goal isn't simply to reconnect faster — it's to prevent the proxied TCP connection from being destroyed when only the transport carrier has failed.

    I also don't think this necessarily needs to become another QUIC implementation. A minimal session layer could have a much narrower scope:

    • session ID
    • monotonically increasing sequence numbers
    • ACKs
    • bounded retransmission buffer
    • carrier attach/detach
    • a short resume timeout

    The carrier (XHTTP/H2/etc.) would then be treated as replaceable, while the actual proxied TCP session remains alive.

    I agree that there are many edge cases, but I think the key question is whether the use case is valuable enough to justify the mechanism. For users who specifically need uninterrupted long-lived TCP sessions over transports that can be rotated or temporarily interrupted, I believe it is.

    Would you consider the idea if it were limited to a single transport such as XHTTP initially, rather than trying to make it a general Xray-wide mechanism?
    This needs to be addressed somehow , if generic mechanism is hard to implement , then XHTTP is the easiest protocol to Implement such feature.
    Maybe it should remain open for someone to submit a PR . Vibe coding has become viral recently and it's even accepted by RPRX

  5. anonymously-hidden commented on Oct 6, 2026

    @anonymously-hidden
    ContributorAuthor

    Another point I would add is that, in networking, stability and continuity are generally preferred over repeatedly tearing down and rebuilding connections.

    Even relatively small amounts of packet loss can have a disproportionate impact on TCP throughput and latency because of retransmissions, congestion control, and head-of-line blocking. And when the loss isn't just a packet but an entire transport connection, the cost is much higher: the application may have to tear down its state and establish everything again.

    That's why I think there is value in distinguishing between temporary carrier instability and actual session failure. If an XHTTP/H2 carrier disappears for a few seconds but the underlying logical TCP session is still perfectly valid, destroying that session seems unnecessarily expensive.

    Of course, I'm not suggesting that every connection needs this level of resilience. But for long-lived connections, making the carrier replaceable could turn a transient transport failure into something effectively transparent to the application.

  6. Fangliding commented on Oct 6, 2026

    @Fangliding
    Member

    No
    And all traditional transport modules are still maintained by full human

  7. anonymously-hidden commented on Oct 6, 2026

    @anonymously-hidden
    ContributorAuthor

    this is my literal game screen every while ( 1-2 min )

    Image
  8. anonymously-hidden commented on Oct 6, 2026

    @anonymously-hidden
    ContributorAuthor

    And the Reason I hate using Mux...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions