Network.connectionInactivity()

Overview

Gets the number of seconds of inactivity for the session. The inactivity counter resets with any incoming or outgoing data.

Only available for Telnet sessions.

Added in version 2.1.5

Format

var seconds = Network.connectionInactivity();

Value Description Type Required Notes
seconds The number of seconds of inactivity. Integer Return Returns -1 if unable to determine how long the connection has been inactive.

Example

Copy
/* Press the F1 key after 5 minutes (300 seconds) of inactivity.
*/
function checkInactivity() {
    var seconds = Network.connectionInactivity();
    if(seconds >= 300) {
        Device.sendKeys("{F1}");
    }
}
 
// check every 30 seconds
setInterval(checkInactivity, 30000);