Comet

Comet is an umbrella term for all old HTTP-based hacks which were used to simulate bi-directional realtime communication between a web client and server. It is a phrase that we should hopefully hear mentioned much less over the coming years. WebSockets are where we want to be; browsers and beyond.

Comet solutions tend to use a number of solutions to achieve HTTP Long-Polling or HTTP Streaming. XMLHttpRequest, Forever-IFrame, ActiveX controls and even Java Applets. The most commonly used solutions now are the XMLHttpRequest object, the Forever-IFrame and JSONP Long-Polling.

HTTP Long-Polling

HTTP Long-polling is a technique used to push updates to a web client. A connection is held open between the web client and the web server so that when the server has new information it can push it to the client. That connection is then closed. A new connection is then established between the client and the server and then wait for another update from the server.

HTTP Streaming

HTTP Streaming is a technique used to push updates to a web client. A persistent connection is held open between the web client and the web server so that when the server has new information it can push it to the client. This is a truly persistent connection that will only drop due to network problems or through user action e.g. navigating away from a web page or the application is closed.

WebSockets

WebSocket is a specification that allows realtime bi-directional full-duplex communication between a web client and a web server over a single TCP connection. It represents a solution to older Comet hacks that have been used for over 10 years in order to simulate this type of communication.

Although initially created with web browsers in mind it is a specification so can be implemented by any technology that can make a TCP connection. Because of this there are client library appearing in numerous technologies (see WebSocket Client Libraries.

Server Sent Events (EventSource API)

Server-Sent Events is a technology for providing uni-directional communication between a web server and web clients in the form of DOM (Document Object Model) events.

Realtime Web Apps: With HTML5 WebSocket, PHP, and jQuery

Buy the book I co-write with Jason Lengstorf via Amazon.com or Amazon.co.uk

BladeRunnerJS - Divide & Conquer your Web Apps
BladeRunnerJS: Divide & Conquer your Web Apps

BladeRunnerJS is a development toolkit and lightweight framework for building web applications consisting of one or more components called Blades. It comes complete with some seriously useful tools which make it easy to develop, test and deploy your app.

Find out more