Storage Informer
Storage Informer

Creating a VT100 terminal in JavaScript

by on Jul.19, 2010, under Storage

Creating a VT100 terminal in JavaScript

I have been building a web site for remotely monitoring and managing computers from a single web site. Well, I am working on adding more features to the site and one thing I would like to do it get a command prompt on any computer from the web page. This would be fun because you would be able to access the command prompt of a remote computer from a light weight device like an Netbook or Apple iPad. To make everything efficient, I wanted to build a VT100 terminal in Javascript, this way, I would use AJAX (http) to push data to the terminal and the client would take care of displaying the data correctly. It would also minimize the amount of data handled by the server since it would only have to deal with short character strings instead of screen bitmaps, etc.

last week, I got started using the HTML5 canvas element to draw a 80×25 terminal and get characters displayed into it. This new canvas thing it very cool. It&aposs like having a JavaScript controlled drawing surface that even scales with the browser width. I also found a way to copy the terminal up a line when the cursor is at the bottom and you need a new line at the bottom. I have not handled VT100 escape codes yet, but it should not be too difficult. I have C# code I have built in the past so I know how to get that done.

Now that I have the basics of a terminal in a browser, I needed to hook it up to the web service. For this, I use JQuery a very good library for helping with JavaScript across many browsers. It has AJAX calls that I can do to call back the web server a get more terminal data. I also have a backside server message bus I can hookup to, making the solution complete. I still have a lot of work to do, but so far it seems like it&aposs going to be possible to get a command prompt from the web site.

Of course, there is a security issue. By default, the web site does not have authorization to open a command prompt to any computer, but I have a special peer-to-peer policy I can use to override this and allow the site to get access. The problem of course is that if someone hacks the web site, he can have access to people&aposs computers…. not good. So, while all of this is very cool, it may only be useful for demos and exceptional cases.



Leave a Reply

Powered by WP Hashcash

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...