Wednesday, June 24, 2009

Gear it up – Web applications go offline

Gears is an exciting addition to web application development strategies. It opens a new dimension for web applications. Gears is an open source browser extension which extends the functionality of a browser and enables web developers create applications which can work offline. Gears does this with the help of three core modules LocalServer, LocalDatabase and WorkerPool.

A local server is used to cache web application resources such as html pages, images etc. to enable the application work in offline mode. Local database allows the developer to retrieve/store data locally on the user’s computer while working offline. This database can then be synchronized with the remote database while working online. Worker thread pool allows heavy duty operations in the background making the application more responsive.

The architecture of Gears is such that it allows the developer to write code which rather than contacting remote database directly works with an intermediate object which can be considered as Data Switch. This object can then figure out whether to retrieve the data from a local database or contact remote database for latest information. The developer can choose to develop the application as either Model or Modeless. In Model applications users can choose to work online/offline whereas in Modeless it happens seamlessly in the background. The developer can also choose to enable certain features of the application work offline while making certain feature work only online as those features might require updated data. The data synchronization can also be done either manually, letting the user specify when to synchronize or it may happen in the background without user’s intervention.

Gears do implement security features as well. It requires user’s permission to allow Gears to be able to make the applications work offline as Gears allow the developers to write the content on user’s machine. Also, the applications can access the databases created by that application and capture urls from the same origin. It is still in consideration to allow applications from other origins to access resources of different origins.

Though Gears is a beta release yet and considered to be a developer only release, you may find some samples on It would be nice to see how exciting applications can be developed with Gears.

No comments:

Post a Comment