Network

Push, or server push, refers to communication where the request is initiated by the server. It is contrasted with pull, where the request for the transmission of information is initiated by the client.

Comet is a collective term that includes many ways that allow a web server to push data to a browser over a long-held HTTP request. Comet is also known as AJAX Push, Reverse AJAX, Two-way-web, HTTP Streaming, and HTTP server push.

AJAX (Asynchronous JavaScript And XML) is the process of exchanging data with a server, without doing a full page refresh. Despite its outdated name, XMLHttpRequest can be used to retrieve any type of data, not just XML.

To achieve this, the client must create, set and then send a JavaScript XMLHttpRequest object, and wait for the response from the server. Alternatively, the Fetch API can be used.

A common approach to implementing an online chat system is to use long polling, in which an AJAX request is kept open until the server has new data, and upon receiving the server response the browser fires a new AJAX request. Such a method is simple and well-supported by browsers.