feat: SSH session persistence across app background/foreground#8
Merged
LukeGus merged 18 commits intoTermix-SSH:dev-1.3.1from Mar 3, 2026
Merged
Conversation
* feat: add iPadOS build workflow without EAS dependency (Termix-SSH#4) * fix: handle physical keyboard special keys in terminal Tab, Escape, and arrow keys from physical keyboards were filtered out by the key.length === 1 check. Add explicit handling like Enter/Backspace. * feat: add iOS native Shift+Tab support via UIKeyCommand Add Expo native module that uses UIKeyCommand + method swizzling to intercept Shift+Tab on iOS hardware keyboards and forward the backtab escape sequence (\x1b[Z]) to the active terminal. --------- Co-authored-by: swing <bestswngs@gmail.com> Co-authored-by: Luke Gustafson <88517757+LukeGus@users.noreply.github.com>
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
LukeGus
added a commit
that referenced
this pull request
Mar 9, 2026
* feat: SSH session persistence across app background/foreground (#8) * fix: ipad keyboard issue + paste key not wokring and disabled auto correct * fix: ipad keyboard issues * fix: ipad styling issues, emoji/voice dictation support, android keyboard issues * fix: ipad styling issues * feat: add debuging to fix ipad keyboard margins * fix: handle physical keyboard special keys in terminal (#6) * feat: add iPadOS build workflow without EAS dependency (#4) * fix: handle physical keyboard special keys in terminal Tab, Escape, and arrow keys from physical keyboards were filtered out by the key.length === 1 check. Add explicit handling like Enter/Backspace. * feat: add iOS native Shift+Tab support via UIKeyCommand Add Expo native module that uses UIKeyCommand + method swizzling to intercept Shift+Tab on iOS hardware keyboards and forward the backtab escape sequence (\x1b[Z]) to the active terminal. --------- Co-authored-by: swing <bestswngs@gmail.com> Co-authored-by: Luke Gustafson <88517757+LukeGus@users.noreply.github.com> * feat: improve ipad ui logic and improve external keyboard handling * feat: fix arrow keys and modifier keys on hardware keybords * fix: fix arrow keys and modifier keys on hardware keybords * feat: add voice over support and improved terminal background conneciton * feat: add missing files * feat: add host key verification support * fix: dictation issues + android IME multi character input issues on android * fix: none auth hosts * chore: clean * chore: update readme * feat: add SSH session persistence for background/foreground transitions 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 --------- Co-authored-by: LukeGus <bugattiguy527@gmail.com> Co-authored-by: swing <bestswngs@gmail.com> Co-authored-by: Luke Gustafson <88517757+LukeGus@users.noreply.github.com> * fix: clear terminal after reconnecting and fix letter duplcation * chore: increment ver --------- Co-authored-by: ZacharyZcR <PayasoNorahC@protonmail.com> Co-authored-by: swing <bestswngs@gmail.com>
LukeGus
added a commit
that referenced
this pull request
Mar 15, 2026
* feat: SSH session persistence across app background/foreground (#8) * fix: ipad keyboard issue + paste key not wokring and disabled auto correct * fix: ipad keyboard issues * fix: ipad styling issues, emoji/voice dictation support, android keyboard issues * fix: ipad styling issues * feat: add debuging to fix ipad keyboard margins * fix: handle physical keyboard special keys in terminal (#6) * feat: add iPadOS build workflow without EAS dependency (#4) * fix: handle physical keyboard special keys in terminal Tab, Escape, and arrow keys from physical keyboards were filtered out by the key.length === 1 check. Add explicit handling like Enter/Backspace. * feat: add iOS native Shift+Tab support via UIKeyCommand Add Expo native module that uses UIKeyCommand + method swizzling to intercept Shift+Tab on iOS hardware keyboards and forward the backtab escape sequence (\x1b[Z]) to the active terminal. --------- Co-authored-by: swing <bestswngs@gmail.com> Co-authored-by: Luke Gustafson <88517757+LukeGus@users.noreply.github.com> * feat: improve ipad ui logic and improve external keyboard handling * feat: fix arrow keys and modifier keys on hardware keybords * fix: fix arrow keys and modifier keys on hardware keybords * feat: add voice over support and improved terminal background conneciton * feat: add missing files * feat: add host key verification support * fix: dictation issues + android IME multi character input issues on android * fix: none auth hosts * chore: clean * chore: update readme * feat: add SSH session persistence for background/foreground transitions 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 --------- Co-authored-by: LukeGus <bugattiguy527@gmail.com> Co-authored-by: swing <bestswngs@gmail.com> Co-authored-by: Luke Gustafson <88517757+LukeGus@users.noreply.github.com> * fix: clear terminal after reconnecting and fix letter duplcation * chore: increment ver * fix: use new 2.0.0 api routes and filter non ssh hosts * chore: increment ver --------- Co-authored-by: ZacharyZcR <PayasoNorahC@protonmail.com> Co-authored-by: swing <bestswngs@gmail.com>
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