Client Push Services Open Up Real-Time to Everyone

The number of services offering real-time APIs is slowly but surely expanding and it looks like we're going to have to add quite a few more. Since the start of the year a new type of service has started to appear--client push services, which help developers include real-time updates in their web apps.

Real-time client push APIs have actually been around for quite a while (around 10 years) as they are shipped with Comet servers but only recently have these been moved into the cloud and offered as a service. The service flavour of these APIs give the developer the ability to instantly push information from their web server, through their chosen push service and into a web browser viewing their website. -- real-time multi-player word game

Real-time client push is intended to replace the previous pull, or Polling, mechanism that has been used for many years to mimic live data on a website. Using push via a dedicated Comet server is generally more Resource efficient than polling a web server, and by using a service the resource load and complexity involved in setting up and running a Comet service is completely taken away from the developer's considerations. This means that the web server is under much less strain, the developer can concentrate on building a killer real-time application and the website user gets the benefit of a truly real-time experience.

These services have only recently started to pop up due to a number of technology advancements. To be able to use a real-time client push service the web browser needs to be able to maintain a persistent connection back to the web server so that the web server can push information to it as soon as it becomes available. This has been achievable for a number of years via what some developer have labelled as "hacks" but is now easier than it has ever been. Most of the new services use the JavaScript WebSocket object to achieve this and fallback to using Flash if Websockets are not supported by the browser.

The web browser also needs to be able to maintain a cross domain connection from the JavaScript code running in the website to the service e.g. a connection from to In older browsers cross domain connections were not allowed but the introduction of client access policy files (crossdomain.xml and clientaccesspolicy.xml) and more recently the Access-Control-Allow-Origin HTTP header have made cross domain calls from JavaScript possible (You can find more information and a demo of this in action here).

All of the real-time client push services have adopted a data publisher subscriber model with the web server code generally acting as the data publisher and the JavaScript code running in the web browser acting as the data subscriber. Subscriptions are made to a channel (or topic), that either exists or will be created, within the service and are identified by a name e.g. "my_channel" or "/PW/CHAT". The publishers then simply publish data to that channel or topic using a service API and the information is instantly received by all subscribers, again via an API.

The real-time client push services that we know of at the moment are:

And some examples of their use include:

You can also check out the demos on each of the services websites.

The real-time 'meh' button

Real-time is already a big topic and users are starting to demand data and results as fast as possible. There is also the expectation that they should be informed as soon as new data is available or the existing data changes. Google are already pressing ahead with new real-time advancements such as Google Real-Time search (which actually uses polling) and Google Instant but the good news is that with the availability of real-time client push services any developer can now add real-time to their website.

Let us know if you are interested in finding out more about these real-time client push APIs and services and we'll cover each one in more detail.

Photo via Blake Patterson

Be sure to read the next API article: FCC to Developers: Push Us Forward