From 4b53139c200d0426e8b80d0573958d4f87c44314 Mon Sep 17 00:00:00 2001 From: Karmaa <88517757+LukeGus@users.noreply.github.com> Date: Thu, 31 Jul 2025 14:55:40 -0500 Subject: [PATCH] Update ssh.ts to fix 60 second disconnect --- src/backend/ssh/ssh.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/backend/ssh/ssh.ts b/src/backend/ssh/ssh.ts index b94dcb8c..5a5dfca2 100644 --- a/src/backend/ssh/ssh.ts +++ b/src/backend/ssh/ssh.ts @@ -130,6 +130,12 @@ wss.on('connection', (ws: WebSocket) => { sshStream = stream; + const keepaliveTimer = setInterval(() => { + if (sshStream && sshStream.writable) { + sshStream.write('\x00'); + } + }, 30000); + stream.on('data', (chunk: Buffer) => { ws.send(JSON.stringify({ type: 'data', data: chunk.toString() })); }); @@ -177,8 +183,8 @@ wss.on('connection', (ws: WebSocket) => { host: ip, port, username, - keepaliveInterval: 5000, - keepaliveCountMax: 10, + keepaliveInterval: 10000, + keepaliveCountMax: 60, readyTimeout: 10000, algorithms: { @@ -261,4 +267,4 @@ wss.on('connection', (ws: WebSocket) => { sshConn = null; } } -}); \ No newline at end of file +});