Ajax server push

Source: Internet
Author: User

1. Http PULL mode: In this traditional method, the client checks the latest data on the server at user-defined intervals. This pull method requires a high frequency to ensure high data accuracy, but a high frequency may lead to excessive checks, resulting in high network traffic. On the other hand, low frequency will lead to missing updated data. Ideally, the pull interval should be equal to the speed at which the server status changes.

 

2. Http stream: This method is composed of server data streams that exist in an uninterrupted HTTP connection response or an XMLHttpRequest connection.

 

3. Reverse Ajax: the Ajax or comet is called reverse Ajax. It allows the server to send a message to the client when an event occurs, without the explicit request from the client. The goal is to achieve real-time update of status changes. Comet uses the persistent connection feature in HTTP/1.1. Through HTTP/1.1, unless otherwise stated, the TCP connection between the server and the browser will remain connected until one Party sends an explicit "close connection" message, or a timeout or network error occurs.

 

4. Long polling: This is also called asynchronous polling. This method is a mixture of pure server-side push and client pull. It is based on the Bayeux protocol. This Protocol follows the topic-based publishing-subscription mechanism. After you subscribe to a channel, the connection between the client and the server will remain open for a period of time specified in advance. If no event occurs on the server and a timeout occurs, the server requests the client to perform an asynchronous reconnection. If an event occurs, the server sends data to the client and then the client reconnects. In their experimental research, the authors are located between an Ajax application that uses the comet push method (Dojo's cometd Library) and an application that uses the pure pull method, data Consistency, server performance, network performance, and data loss were compared.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.