Write websocket data to terminal

This commit is contained in:
Radon Rosborough 2020-06-06 12:34:26 -06:00
parent aa57cc7e74
commit 660203f598
1 changed files with 7 additions and 3 deletions

View File

@ -32,11 +32,15 @@ socket.addEventListener("message", (event) => {
}
switch (message?.event) {
case "terminalOutput":
console.log(message.output);
break;
if (typeof message.output !== "string") {
console.error("Unexpected message from server:", message);
return;
}
term.write(message.output);
return;
default:
console.error("Unexpected message from server:", message);
break;
return;
}
});
socket.addEventListener("close", (event) => {