Web sockets work with chrome packaged apps

Akshat Jiwan Sharma, Sun Oct 13 2013

Although both chrome os and mozilla os offer the ability to create native packaged applications (which behave like desktop applications ) using html , css and javascript it is not clear if they support all features of html 5. Applications made using mozilla os for example can not use webRTC at present. In chrome os however web rtc is supported.

So I wondered if it was possible to use html 5 web sockets on chrome apps. I could not find much documentation regarding my question so I decided to try it myself. I cloned the excellent github repository of samples and chose the simplest one (hello world) to test the functionality. Well it works. Here is my repo

To run a packaged app you need to go to tools-> extensions -> load unpacked extensions and navigate to where you have cloned the extension. It will then be available from the new tabs page in the extension categories.

There were a few interesting things I noticed while developing chrome apps.

  1. You can use external browser libraries like jquery. Although the libraries must be present in the local folder. That is they can not be downloaded from the cdn.
  2. The html files represent the "windows" all the presentation logic is written in the html markup.
  3. The app run time is managed by background script. This script is mandatory and must be specified in a manifest file.
  4. However the dom manipulation can be done by other client side libraries they are included on the html page just like any other web application.

My first experience with chrome apps has been quite positive. It is good to know that they support both Web sockets and web rtc. I wish that in the future it becomes possible to run these apps on mobiles. There is a large subset of applications that could benefit from it. I am planning to experiment with apps on mozilla os as well but there is still a lot to discover in chrome apps.


comments powered by Disqus