Keep SSH session alive.

This commit is contained in:
Karmaa
2025-03-21 00:50:26 -05:00
parent 8209fb5318
commit 4f384dd60b
2 changed files with 16 additions and 2 deletions

View File

@@ -178,7 +178,16 @@ export const NewTerminal = forwardRef(({ hostConfig, isVisible, setIsNoAuthHidde
}
});
const pingInterval = setInterval(() => {
socketRef.current.emit("ping");
}, 5000);
socketRef.current.on("pong", () => {
console.log("Received pong from server.");
});
return () => {
clearInterval(pingInterval);
if (terminalInstance.current) {
terminalInstance.current.dispose();
terminalInstance.current = null;