This article explains why you’ve found your session lost or a port forwarding rule disconnected after you put the app to the background, and presents a few tips that might help you to overcome the issue.
Termius, like most of other apps, can’t run in the background due to a restriction of iOS. The latest version of iOS stops the app’s background processes almost immediately (in 20 or 30 seconds), while older versions would allow them to run for 2 - 3 minutes.
That restriction exists for good reasons: to improve battery usage and performance of your device. However, it may present an obvious problem for users of Termius. Below is a few recommendations to overcome it.
If you are aware of the current limitations, you can plan ahead the tasks you need to do while the app is not in the foreground. For example, if you decide to take a call, keep in mind that iOS will drop your connections in 20 or 30 seconds (if you’re on iOS 13).
On an iPad, you can utilise Split View for running Termius and another app simultaneously. See more here.
screen or tmux can prevent losing the content of the terminal screen when the connection is lost. However, this tip isn’t relevant, when you switch to the background and a port forwarding rule is active.
Hint: with a startup snippet, you can make tmux or screen start automatically upon a connection (see the image below).
When you make a connection in Termius, that session is logged in History. It provides a log of activity and allows you to add these past sessions as hosts.
If you enable location tracking, it will also allow you to see on a map the exact location where a connecting was made.
As a side effect of turning on location tracking, your background connections will also no longer be interrupted.