We are looking at building a web-based ssh for teaching linux for newbies.
However, we want to be able to read input before it gets executed on the backend terminal, and read output before it gets displayed on the browser so as to make decisions in the web application based on these.
I looked into xterm.js, but don't know how to enable this sort of control, with any of the present open source web based terminal emulators.
Any idea how to get started?
What you have to do is to create an xterm.js add-on similar to the attach
addon, but a bit more interventional.
In a few points, you will have to:
data
event and after processing it, send the data to the socketmessage
WebSocket event and process the message, before writing it to the terminal, using #write
A quick look to the attach
addon source code could also be enlightening