diff --git a/app/terminal/index.html b/app/terminal/index.html index efb98da..7855196 100644 --- a/app/terminal/index.html +++ b/app/terminal/index.html @@ -121,7 +121,16 @@ window.addEventListener("resize", sendSizeToServer); } - socket.onclose = () => {} + + socket.onmessage = (msg) => { + if(msg==="Closing"){ + socket.close(); + } + } + + socket.onclose = () => { + window.close(); + } socket.onerror = () => {} diff --git a/app/terminal/server.js b/app/terminal/server.js index fb630a3..53aa73a 100644 --- a/app/terminal/server.js +++ b/app/terminal/server.js @@ -1,7 +1,9 @@ this.Pty = require("node-pty"); this.Websocket = require("ws").Server; -this.onclosed = () => {}; +this.onclosed = () => { + ws.send("Closing"); +}; this.onopened = () => {}; this.onresize = () => {}; this.ondisconnected = () => {};