VT100 - RS323 - Websocket - Beginner questions #4883
-
Hi Everyone, I am absolutely new to xterm.js and frontend development in general, so I appreciate any links or help. My current setup consists of a computer with an RS323 Interface that sends all boot/terminal messages to the serial output. I can print the messages line by line on a website as follows:
To make all this a bit more interactive and use it as an IPMI replacement I would like to provide xterm.js via the micropython webserver (microdot) to my browser and connect xterm.js with the websocket. My problem: I have no idea how to "provide" xterm.js to my client computer, all I could find so far were install tutorials that used npm. My questions would be:
Thanks for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
I think the most basic document setup would look like this (untested): <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>terminal test</title>
<link rel="stylesheet" href="node_modules/xterm/css/xterm.css">
<script src="node_modules/xterm/lib/xterm.js"></script>
<script src="node_modules/xterm-addon-attach/lib/xterm-addon-attach.js"></script>
</head>
<body>
<div id="terminal"></div>
<script>
const term = new Terminal(yourConfigOptions);
const attachAddon = new AttachAddon.AttachAddon(yourWebSocket);
term.loadAddon(attachAddon);
term.open(document.getElementById('terminal'));
</script>
</body>
</html> so the needed files to be served by your webserver are |
Beta Was this translation helpful? Give feedback.
-
Hi @jerch I absolutely agree with you on the security aspect. Next step would probably be some more work on the websocket format: Looking at this, would you happen to know what format xterm.js would expect from the websocket? |
Beta Was this translation helpful? Give feedback.
-
Simply forwarding the bytes to xterm.js and replacing all Nones with "" was enough. It looks really great! |
Beta Was this translation helpful? Give feedback.
I think the most basic document setup would look like this (untested):
so the needed …