on Jul 5th, 2007Getting Familiar with Google Gears

Google Gears was released recently as an effort to promote offline web. I have written time and again about this genre of web applications and have spoken about the advancements like the Dojo Offline Toolkit, AIR and the new Silverlight that try to blemish the line between web and desktop applications.

Google Gears is designed ingeniously. Gears is an activex plugin on IE and an XPI on firefox(installables) . Gears then works in your browser for any applications designed to use the gears technology. The foremost application that uses gears is Google Reader, which can store and retrieve almost 2000 articles. The transition between online and offline web is supposed to be seamless, as in one taking over when the connectivity is out and the other when its back. In reader, you have to explicitly make the shift from online to offline, something like the work offline option in IE.

The core essentially consists of three modules :

  • Local Server Module : Creates a local server like emulator in which you can cache urls javascript, image etc. The ResourceStore module is used to capture resources that have to be accesed using a URL. ie supposing you were visiting my homepage, the resources like my resume or my portfolio , that need to be accessed via URL’s can be cached. The other variant is the ManagedResourceStore which automatically updates the cached information. In each case the URL’s and the cache in general has to be specified in a manifest file. The LocalServer intercepts HTTP/HTTPS requests and serves them from the cache if URL is cached in a ResourceStore or ManagedResourceStore (which is enabled) and the cookie of that information is present. This happens irrespective of the network connection.
  • Local Database : This module is taken as an enhancement to SQLite , the micro database in C that can be configured and run in under 250Kb of memory. The gears javascript library provides method to create a new local database and also allows from complete SQLite SQL operations.
  • Worker Pool : Almost every web developer has come across the long running script -> continue or break dialog. This usually happens due to an infinite loop in javascript or sometimes a very intensive calculation. The downside to this is that UI becomes non responsive and no action can happen on the front end of the app. The worker pool helps the cause by running these operations in the background. People familiar with thick app programming can relate this to threading, but at the javascript level. But unlike threads the workers do not share state information. The workers can communicate with each other by passing message strings or use JSON.

This advancement not only makes offline web possible but also allows for a new breed of applications to be born. Applications that need a server only to sync and not to compute or perform functionality. Think of a MyBlogLog offline for example, you visit a blog where you have a MyBlogLog reader that you have already encountered before the system tells you about your past encounters and on what pages. A distributed social network of sorts!!

One Response to “Getting Familiar with Google Gears”

  1. [...] of personalization information. You can use a add on activex plugin or a firefox addon like google gears with underlying SQLite database and do wonders with it. Of course this would mean about two years of thinking of standards and more [...]

Trackback URI | Comments RSS

Leave a Reply