Universal Messaging 10.1 | Developer Guide | Web Client APIs | Web Developer's Guide for Javascript | JavaScript Communication Drivers and Protocols | Comet LongPolling Delivery Mode
Comet LongPolling Delivery Mode
An Introduction to Comet LongPolling
LongPolling is a variation of the traditional polling technique. In traditional polling, a client sends requests on a regular basis to the server attempting to pull any new data available on the server. If there are no events on the server an empty response is returned and after a specified delay the client sends a new request.
LongPolling sends requests to the server in much the same way as traditional polling. In a LongPoll implementation however if the server has no data to push it holds the request up until the point where new data is available or the request times out. Once the server sends a LongPoll response the client typically initiates a new request immediately.
As the server usually holds a LongPoll request at all times from the client. It is able to asynchronously push data to the client by providing it with a response.
Comet LongPolling in Universal Messaging
The LongPolling delivery mode is supported by Universal Messaging's JavaScript API and can be used by all browsers. In addition to LongPolling, WebSocket and Forever IFrame delivery modes are also offered by the API.
LongPolling is a desirable option when the implementation must support older browser versions, or also when requests must traverse proxy servers which may not be configurable by those developing the application. Other delivery modes often require newer browsers or unobtrusive end-to-end connections.
Longpolling drivers in Universal Messaging JavaScript include XHR with CORS, XHR with postMessage, XDR and JSONP. Please see JavaScript API Documentation for Drivers for more details.