feat: SSH session persistence across app background/foreground#8
Open
ZacharyZcR wants to merge 1 commit intoTermix-SSH:dev-1.3.0from
Open
feat: SSH session persistence across app background/foreground#8ZacharyZcR wants to merge 1 commit intoTermix-SSH:dev-1.3.0from
ZacharyZcR wants to merge 1 commit intoTermix-SSH:dev-1.3.0from
Conversation
Adapt the mobile client to the server-side session persistence protocol (Termix PR #594). When the app goes to background and the WebSocket dies, the server keeps the SSH session alive. On foreground return, the client sends attachSession instead of connectToHost, reattaching to the existing session with buffered output replay. - Track server sessionId from sessionCreated messages - Send attachSession on reconnect when a sessionId exists - Handle sessionExpired with automatic fallback to fresh connectToHost - Handle sessionTakenOver for multi-device scenarios - Send explicit disconnect on destroy to clean up server sessions - Skip terminal clear and post-connection setup on reattach
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
attachSessionto reattach with buffered output replay instead of creating a new SSH connection.sessionCreated,sessionAttached,sessionExpired(auto-fallback to fresh connect), andsessionTakenOver(multi-device graceful disconnect).disconnecton component destroy to clean up server-side sessions when the user intentionally closes a terminal tab.Files Changed
app/tabs/sessions/terminal/NativeWebSocketManager.tsserverSessionId, conditionalattachSessionvsconnectToHost, new message handlersapp/tabs/sessions/terminal/Terminal.tsxhasReceivedDataclear on reattachTest plan
session_destroyed)npx tsc --noEmitshows no new errors beyond pre-existing upstream issuesFixes Termix-SSH/Support#364