Repository navigation
Opt-in "Stay connected" for iOS: keep environment connections open in the background #21135
aididhaiqal
started this conversation in
Ideas
Replies: 1 comment
|
Prototype for reference (no PR until the direction is approved): aididhaiqal/t3code@main...feat/mobile-background-keep-alive Related: #21134 fixes a separate Live Activity bug where a rotated per-activity push token was never registered, so cards stopped updating until the app was opened. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
iOS suspends T3 Code a few seconds after you leave it, which closes every environment socket. When you come back, the app has to reconnect and catch up before threads are current. If you check on agents often, that's a delay on every switch. Push notifications and Live Activities cover "tell me when it's done", but:
Terminal apps such as Termius and Blink solve the same problem with an opt-in background keep-alive.
Proposal
An iOS-only setting, off by default, at Settings → Stay connected:
locationbackground mode. iOS keeps the app running, so the existing WebSocket runtime stays connected and keeps renewing its activity lease. Nothing in the connection stack changes.The prototype is about 100 lines of Swift and one settings screen. It adds no server or contract changes.
Trade-offs to decide
locationbackground mode needs a written justification. Termius and Blink ship this pattern, but approval is not guaranteed. We would not use silent audio.beginBackgroundTask, which keeps sockets alive for about 30 seconds after you leave the app. It covers quick app switches but not "check back in 10 minutes".Question for maintainers
Is an opt-in, iOS-only location-based keep-alive a direction you'd accept? If so, is the scope above right: off by default, While Using access only, no Android?
All reactions