noVNC and shell session timeout after 1 minute

Okay thanks for the help! It took some digging but I’ve found a solution. If you add a heartbeat (ping/pong) function to the websocket server then the connection stays open.

For the shell application I added these lines of code to the index file at /var/www/ood/apps/sys/shell/app.js from the official javascript ws package here.

+function noop() {}

+function heartbeat() {
+  this.isAlive = true;
+}

wss.on('connection', function connection (ws, req) {
  var dir,
      term,
      args,
      host,
      cmd = process.env.OOD_SSH_WRAPPER || 'ssh';

+  ws.isAlive = true;
+  ws.on('pong', heartbeat);
   ...
});

+const interval = setInterval(function ping() {
+  wss.clients.forEach(function each(ws) {
+    if (ws.isAlive === false) return ws.terminate();
+
+    ws.isAlive = false;
+    ws.ping(noop);
+  });
+}, 30000);

Then for remote desktop, we added a --heartbeat=30 option to the websockify_cmd snippet in the vnc.rb file, line 135.

/opt/ood/ondemand/root/usr/share/gems/2.7/ondemand/2.0.13/gems/ood_core-0.17.2/lib/ood_core/batch_connect/templates/vnc.rb
# Launch websockify websocket server
echo "Starting websocket server..."
websocket=$(find_port)
#{websockify_cmd} -D ${websocket} --heartbeat=30 localhost:${port}

I didn’t find a fix for the missing password on reconnect like you mentioned, but noVNC should remain open until site_timeout, which is a major improvement.