Magic Terminal over Web Sockets and SignalR
What would a web based IDE be without a terminal component? Well, we no longer need to ponder that question since we've now got the Magic Terminal.
Join the DZone community and get the full member experience.Join For Free
Web based terminal access is one of those crucial components to have if you truly want to build your own DIY cloud system. The first time I came to appreciate web terminals, was with Digital Ocean's droplets, which gave me a web based terminal, allowing me to directly modify my server any ways I saw fit through my browser. Golly gosh that was a najs day.
With a web terminal, you've got all of these features "for free."
- Git integration - Check
- Installing new things on your server - Check
- Configuring your server - Check
- Running Python scripts - Check
- Etc, etc, etc ... (Check, Check, Check)
Now of course the killer feature comes when combining the brand new terminal in Magic with the IDE I created last weekend. The combination of these two little components, more or less solves 80% of my problems related to (manually) creating Hyperlambda apps using Magic - Ignoring the fact that Magic automatically creates most of my code 80% of the time of course. Below you can see the CodeMirror based Hyperlambda IDE/editor in Magic, with syntax highlighting and autocomplete. Everything over a standard browser using Web Sockets and SignalR.
Sockets and SignalR
Now of course the terminal builds on top of web sockets and SignalR, to capture STD OUT and STD ERROR, which I then publish through a SignalR hub, such that subscribers interested in these events can render the output and error as it is occurring, live on the server, on the client/browser, through my wrapper around XTermJS. However, the sockets parts of Magic I will go through thoroughly in later articles, so to keep this article short and focused, I'll wrap up by demonstrating the terminal for you, if you're too lazy to download Magic for yourself.
Notice, both the SignalR wrappers and the Terminal component are a bit experimental as of this writing, and I might need to change the API in the future - So be aware of this in case you want to go berserk and try it out for yourself. If you're reading this article a month down the road though, you've got little to worry about, and feel free to go berserk as you see fit. Now all I'll need is GitHub actions integration, and I've basically got a complete DIY cloud and DevOps environment, entirely created on top of Open Sauce, possible to install through a simple Docker image on your own virtual machine. Below are all relevant links. Documentation might need some more massaging, but it should be fairly easily understood.
Opinions expressed by DZone contributors are their own.