Someday soon, users may be able to interact with their favorite websites even when these sites aren't accessible, thanks to a new browser standard called Service Workers being developed by Google.
With Service Workers, "We can make sure when you go to your site, it always feels responsive, that it is always there, even if it isn't up-to-date," explained Google software engineer Alex Russell at the O'Reilly Velocity conference, held this week in New York.
A Service Worker "is basically an in-browser proxy that gives you the power to script what happens before you go to the network, and what happens after you get back from the network," Russell explained to an audience of Web developers and administrators.
Russell is a co-editor of a World Wide Web Consortium draft specifying how Service Workers should be implemented in browsers.
Service Workers would provide a space on the user's browser for offline processing, allowing a website to store documents, and offer resources. It could also speed delivery of Web content by reducing the amount of back-and-forth communication that goes on between a browser and a server.
Web users are accustomed to seeing only a simple error statement if a browser can't access a website. This however, is an anachronism, a primitive approach compared to how modern desktop applications work, Russell explained.
For instance, a person using a smartphone may enter a subway station with Wi-Fi access and, while waiting for a train, check in at a favored news site. Boarding a train, the user clicks on a news story from the site, but as the train leaves the station, the phone loses access and the Web page fails to load.
"You're in limbo. You can't go forward and you can't go back. This is a really terrible user experience and it makes us not trust the Web," Russell said.
"Native applications make a different break," Russell said. "The user interface they surface to you will probably work, and if it doesn't work, it will probably tell you why it is not working, and it does so because it is loading something instead of nothing."
"That is the key differentiator. We want to load something instead of nothing," Russell said.
Service Workers allow the developer to treat a Web page like a desktop application, with a shell stored locally to serve as the initial user interface. A Service Worker could fill the shell with information if the site is offline, providing the user with cached pages, or other information and functionality to peruse until access is restored.
This could change the nature in which Web pages are delivered in a number of ways, Russell explained.
With Service Workers, when a user calls a certain website, an interface stored on the device is brought to the screen first, rather than a page delivered by a server. Instead of downloading a series of single pages, a user connecting to a site is synchronizing an existing local data set with a master data set on the server.
Service Workers are procedural in nature, meaning developers can write scripts to carry out complex actions, such as caching material for offline use or interpreting a stream of complex instructions sent by the server for a rich Web application.
They work in asynchronous mode -- in the background -- and won't block any other operations on the browser. A page won't stop loading, for instance, when waiting for a large image file.
In addition to offering a buffer of content and additional local functionality, Service Workers could also improve the response times of websites, Russell said.
Today, a Web page should load within about 1,000 milliseconds to feel instantaneous to the user, Russell said. This can be a challenging time frame given the immense amount of overhead needed to contact a server and have it deliver a Web page, especially over a cellular network.
With the standard Internet TCP/IP stack running over a cellular network, anywhere from 300 to 700 milliseconds are required just to get the client and server chatting with each other.
Service Workers could speed user interactions by up to 600 milliseconds for every second of a Web transaction.
Correctly configured, Service Workers could eliminate or streamline networking operations such as DNS (Domain Name Service) Web address lookups, TCP and control plane setup, encryption handshakes and the overhead incurred by HTTP requests.
The project is one of a number of recent initiatives that Google has taken to improve the performance of the Web for users and developers. The company will typically generate new technology and then work to get it standardized so it can be used by all Web browsers.
Another project Google has underway in this regard is Web Components, which could provide a way to assemble complex Web pages using small single-function components.
Google is in the process of incorporating Service Workers into its Chrome browser by the end of the year. Firefox is also implementing Service Workers, Russell said.
Join the CIO New Zealand group on LinkedIn. The group is open to CIOs, IT Directors, COOs, CTOs and senior IT managers.