diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 2cacb4cf..c369c50a 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,15 +4,10 @@
-
+
-
-
-
-
-
-
-
+
+
@@ -30,12 +25,12 @@
{
"lastFilter": {}
}
- {
- "selectedUrlAndAccountId": {
- "url": "https://github.com/LukeGus/Termix",
- "accountId": "f04977d4-c3b2-400a-9c9b-d5b445f8a970"
+
+}]]>
{
"customColor": "636378de",
"associatedIndex": 8
@@ -142,7 +137,7 @@
-
+
@@ -400,7 +395,15 @@
1733692962039
-
+
+
+ 1733886236040
+
+
+
+ 1733886236040
+
+
@@ -418,7 +421,6 @@
-
@@ -443,6 +445,7 @@
-
+
+
\ No newline at end of file
diff --git a/backend/server.js b/backend/server.js
index 408cae0f..2cd98fd2 100644
--- a/backend/server.js
+++ b/backend/server.js
@@ -43,6 +43,15 @@ wss.on('connection', (ws) => {
if (data?.host && data.port && data.username && data.password) {
conn.on('ready', () => {
console.log('SSH Connection established');
+
+ const interval = setInterval(() => {
+ if (ws.readyState === WebSocket.OPEN) {
+ ws.ping();
+ } else {
+ clearInterval(interval);
+ }
+ }, 15000);
+
conn.shell({ term: 'xterm', cols: currentCols, rows: currentRows }, (error, newStream) => {
if (error) {
console.error(`SSH Shell Error: ${error}`);
@@ -81,6 +90,7 @@ wss.on('connection', (ws) => {
ws.on('close', () => {
console.log('WebSocket closed');
+ clearInterval(interval);
if (conn) {
conn.end();
}
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index c7d21ece..3d1e6649 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -82,7 +82,7 @@ const App = () => {
return;
}
- socket.current = new WebSocket(wsUrl);
+ socket.current = new WebSocket("ws://localhost:8081");
socket.current.onopen = () => {
terminal.current.writeln(`Connected to WebSocket server at ${wsUrl}`);