Fix web-socket timeout.
This commit is contained in:
37
.idea/workspace.xml
generated
37
.idea/workspace.xml
generated
@@ -4,15 +4,10 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="8497df64-d86b-4c98-ac58-c157d9d3fb1e" name="Changes" comment="Update name (need to fix logo)">
|
<list default="true" id="8497df64-d86b-4c98-ac58-c157d9d3fb1e" name="Changes" comment="Final updates (I hope for real this time)">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/backend/server.js" beforeDir="false" afterPath="$PROJECT_DIR$/backend/server.js" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/backend/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/backend/package-lock.json" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/frontend/src/App.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/src/App.jsx" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/index.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/package-lock.json" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/src/logo.svg" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/public/Octocat.png" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/public/manifest.json" beforeDir="false" afterPath="$PROJECT_DIR$/public/manifest.json" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -30,12 +25,12 @@
|
|||||||
<component name="GitHubPullRequestSearchHistory">{
|
<component name="GitHubPullRequestSearchHistory">{
|
||||||
"lastFilter": {}
|
"lastFilter": {}
|
||||||
}</component>
|
}</component>
|
||||||
<component name="GithubPullRequestsUISettings">{
|
<component name="GithubPullRequestsUISettings"><![CDATA[{
|
||||||
"selectedUrlAndAccountId": {
|
"selectedUrlAndAccountId": {
|
||||||
"url": "https://github.com/LukeGus/Termix",
|
"url": "https://github.com/LukeGus/Termix",
|
||||||
"accountId": "f04977d4-c3b2-400a-9c9b-d5b445f8a970"
|
"accountId": "f107d505-1915-4c73-a3f4-e0440737e1dc"
|
||||||
}
|
}
|
||||||
}</component>
|
}]]></component>
|
||||||
<component name="ProjectColorInfo">{
|
<component name="ProjectColorInfo">{
|
||||||
"customColor": "636378de",
|
"customColor": "636378de",
|
||||||
"associatedIndex": 8
|
"associatedIndex": 8
|
||||||
@@ -142,7 +137,7 @@
|
|||||||
<workItem from="1733804654516" duration="339000" />
|
<workItem from="1733804654516" duration="339000" />
|
||||||
<workItem from="1733805003742" duration="9000" />
|
<workItem from="1733805003742" duration="9000" />
|
||||||
<workItem from="1733883751079" duration="757000" />
|
<workItem from="1733883751079" duration="757000" />
|
||||||
<workItem from="1733884522510" duration="1645000" />
|
<workItem from="1733884522510" duration="2569000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Nano zoom fix #11">
|
<task id="LOCAL-00001" summary="Nano zoom fix #11">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@@ -400,7 +395,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1733692962039</updated>
|
<updated>1733692962039</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="33" />
|
<task id="LOCAL-00033" summary="Final updates (I hope for real this time)">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1733886236040</created>
|
||||||
|
<option name="number" value="00033" />
|
||||||
|
<option name="presentableId" value="LOCAL-00033" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1733886236040</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="34" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@@ -418,7 +421,6 @@
|
|||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="Nano zoom fix #15" />
|
|
||||||
<MESSAGE value="Nano zoom fix #16 (ssh-2-promise)" />
|
<MESSAGE value="Nano zoom fix #16 (ssh-2-promise)" />
|
||||||
<MESSAGE value="Full return back to old code with minor fixes" />
|
<MESSAGE value="Full return back to old code with minor fixes" />
|
||||||
<MESSAGE value="Terminal size fix #18 (rows & cols fix)" />
|
<MESSAGE value="Terminal size fix #18 (rows & cols fix)" />
|
||||||
@@ -443,6 +445,7 @@
|
|||||||
<MESSAGE value="Update image name" />
|
<MESSAGE value="Update image name" />
|
||||||
<MESSAGE value="Final changes to release-1.0" />
|
<MESSAGE value="Final changes to release-1.0" />
|
||||||
<MESSAGE value="Update name (need to fix logo)" />
|
<MESSAGE value="Update name (need to fix logo)" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Update name (need to fix logo)" />
|
<MESSAGE value="Final updates (I hope for real this time)" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Final updates (I hope for real this time)" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -43,6 +43,15 @@ wss.on('connection', (ws) => {
|
|||||||
if (data?.host && data.port && data.username && data.password) {
|
if (data?.host && data.port && data.username && data.password) {
|
||||||
conn.on('ready', () => {
|
conn.on('ready', () => {
|
||||||
console.log('SSH Connection established');
|
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) => {
|
conn.shell({ term: 'xterm', cols: currentCols, rows: currentRows }, (error, newStream) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error(`SSH Shell Error: ${error}`);
|
console.error(`SSH Shell Error: ${error}`);
|
||||||
@@ -81,6 +90,7 @@ wss.on('connection', (ws) => {
|
|||||||
|
|
||||||
ws.on('close', () => {
|
ws.on('close', () => {
|
||||||
console.log('WebSocket closed');
|
console.log('WebSocket closed');
|
||||||
|
clearInterval(interval);
|
||||||
if (conn) {
|
if (conn) {
|
||||||
conn.end();
|
conn.end();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ const App = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.current = new WebSocket(wsUrl);
|
socket.current = new WebSocket("ws://localhost:8081");
|
||||||
|
|
||||||
socket.current.onopen = () => {
|
socket.current.onopen = () => {
|
||||||
terminal.current.writeln(`Connected to WebSocket server at ${wsUrl}`);
|
terminal.current.writeln(`Connected to WebSocket server at ${wsUrl}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user