From e7f1ee4112ec4dd725ceee65b2c70f7ce9bf225f Mon Sep 17 00:00:00 2001 From: Richard Klafter Date: Mon, 8 Jul 2019 10:30:55 -0700 Subject: [PATCH] disconnect if idle --- vnc_auto.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vnc_auto.html b/vnc_auto.html index 08b12569..1425c550 100644 --- a/vnc_auto.html +++ b/vnc_auto.html @@ -288,6 +288,19 @@ } rfb.connect(host, port, password, path); + + //disconnect if idle + var lastMove = +(new Date()) + document.addEventListener('mousemove', e => { + lastMove = +(new Date()) + }); + setInterval(function(){ + if(+(new Date()) - lastMove > 30*60*1000){ + console.log('disconnected because of idle') + rfb.disconnect() + } + }, 60000) + };