Update server.js

This commit is contained in:
Bozhidar 2024-04-29 13:10:18 +03:00
parent 5ecae71561
commit 52738f5fc7

View file

@ -149,11 +149,9 @@ wss.on('connection', (ws, req) => {
// Ensure pty is killed when websocket is closed and vice versa
pty.on('exit', () => {
console.log(`Ended pty (${pty.pid})`);
// if (ws.OPEN) {
// ws.close();
// }
pty.kill();
wss.clients.delete(ws);
if (ws.OPEN) {
ws.close();
}
});
ws.on('close', () => {
console.log(`Ended connection from ${remoteIP} (${sessionID})`);