HTML5 Zone is brought to you in partnership with:

John Esposito edits Refcardz at DZone, while writing a dissertation on ancient Greek philosophy and raising two cats. In a previous life he was a database developer and network administrator. John is a DZone Zone Leader and has posted 331 posts at DZone. You can read more from them at their website. View Full User Profile

HowTo: Build a VNC Client for the Browser

12.30.2011
| 8316 views |
  • submit to reddit

VNC is just a special case of client-server, though perhaps an especially cool one.

Quite a few rising web technologies do robust client-server work extra well (Node.js, WebSockets, etc.) -- and in-browser VNC is nothing new.

Here are two (open-source, of course):

  • noVNC is more ambitiously HTML5-duplexed, using WebSockets as well as Canvas. It's quite popular, and has its own 10-page Github wiki. Also supports wss:// encryption. Use this if you want a reliable, battle-tested HTML5 client. (WebSocket fallback is provided by web-socket-js.)
  • vnc.js was written in 24 hours, during LinkedIn's first public Intern Hackday. So of course it hasn't been tested thoroughly, and probably could be written a little more cleanly. But there's something beautifully coherent about an app written in a single session. If the app really does work, then some of the decisions will make a little more sense -- it's possible to get into the developer's mind a little more easily -- and breaking down the code doesn't result in as many 'why did they do this??' moments, because the developers' minds were never far from any part of the project, at any moment during development.


vnc.js doesn't use WebSockets (it uses Socket.io instead), but that's fine -- a little less HTML5, a little more slick JavaScript doesn't hurt anyone.

Plus the marathoning hackers behind vnc.js put together a sweet little tutorial detailing the decisions made that 24-hour period, emphasizing the rapid thought-process behind the architecture (in clear diagrams), and a very practical abstraction for easier in-browser work with TCP (using Node.js and Socket.io) and RFB.

Both packages are worth checking out; the hacking tutorial is a fun read for any web developer interested in coding a VNC client, or even just sophisticated with with different network protocols in the browser.

 

Comments

Ahmed Abbas replied on Fri, 2013/03/15 - 7:04am

Hi..
Thank you for the post.

You wrote "vnc.js doesn't use WebSockets (it uses Socket.io instead),"
Whereas as far as I knw Socket.io does use Web sockets "http://socket.io/#browser-support".
Correct me if I am wrong some here.

Also I see this post was made a year and half ago. Do you knw if there are any good alternative available now.

Ahmed Abbas replied on Fri, 2013/03/15 - 7:04am

Hi..
Thank you for the post.

You wrote "vnc.js doesn't use WebSockets (it uses Socket.io instead),"
Whereas as far as I knw Socket.io does use Web sockets "http://socket.io/#browser-support".
Correct me if I am wrong here.

Also I see this post was made a year and half ago. Do you knw if there are any good alternative available now.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.