Posted in: Archive
As the web becomes more and more realtime across different applications, the browser technology to support such a movement has been playing catchup. There have been plenty of work arounds – polling for new messages (kind of the coding equivalent of your kids in the back of car asking ‘Are we there yet?’ continually) versus true pushing of messages from the server (parents telling the kids ‘we have arrived) isn’t an ideal scenario. The load on the server (from potentially thousands of screaming kids) is a problem, and in some cases, the server my have arrived at the destination before the question comes from the back seat.
In any case, its not true realtime communication.
One of the most interesting parts of the HTML5 specification designed to solve these technical problems, is WebSockets – a way for browsers to communicate in realtime between server and client, by pushing messages directly to the browsers who need the information. There are a number of libraries, startups and open source projects which are making life easier for developers to integrate this type of technology today – (Although its worth pointing out that the specification is in something of a flux at the minute). Some of them are truly realtime, others offer a half way house until this browser technology and its widespread adoption becomes more commonplace. With scaling often being an issue for real time systems, some of these technical solutions and hosted platforms offer developer solutions to what can be a tricky technical problem.
Pusher is a hosted service for quickly and easily adding realtime features into web and mobile applications. The main benefit is that Pusher is scalable out of the box, as they take care of any infrastructure requirement, and lets you concentrate solely on building the application layer. They are used by numerous startups, and offer a variety of hosted plans that match any requirement.
Some of the neat features which are available out of the box with Pusher include authenticated channels so you can control who has access to the messages you broadcast and you can also easily receive a list of users connected to a particular channel.
PubNub is another hosted service for real time. Again, they take of the scaling issues associated with real time communications as part of their overall service. The fundamental difference of PubNub versus Pusher, is that the transport mechanism used is HTTPstreaming, whereas Pusher exclusively uses WebSockets. This isn’t necessarily a negative; arguably the reasoning for this is that currently many WebSockets solutions, even those which degrade gracefully, don’t work for all situations.
From the guys behind real-time application platform Cerrio – X-streamly is a spin off application which is both affordable and scalable. They are built on top of socket.io and provide cross platform support via this library. A number of language APIs are available but they do offer to build out support on your language of choice if you happen to be using something else.
Socket.IO aims to make realtime apps possible in every browser and mobile device, blurring the differences between the different transport mechanisms. It gracefully falls back to the most capable transport mechanism, with native Websockets being the most capable. In essence, Socket.IO lets you forget about the problems of cross platform capability, and concentrate on building your application without hassles. It also enhances websockets by providing built-in multiplexing, horizontal scalability, and automatic JSON encoding/decoding.
Beaconpush offers message persistence meaning that between page reloads and potential restarts of browser/tab, messages will not be lost. You can also address individual users on particular channels in the same way as PusherApp, and whilst it started life as a fully hosted solution, also offers a half way house in the form of their ‘On-site’ edition. This is an alternative hosting model than that in the the cloud-hosted version in the sense that you host the Beaconpush server(s) within your own data centre allowing more control over scaling and technical approaches within your own system architecture.
Hookbox is a Comet server and message queue that tightly integrates with your existing web application via web hooks and a REST interface.
Faye is a publish-subscribe messaging system based on the Bayeux protocol. It provides message servers for Node.js and Ruby, and clients for use on the server and in all major web browsers.
Hook.IO is a distributed EventEmitter and i/o framework for Node which enables the use of small chained processes, each focused on solving one particular task, that forms building blocks for larger and more complex applications. You can build up your application piece by piece by gradually adding small processes that communicates by sending and listening to events.