comet--new technology arising from the rise of Ajax technology

Source: Internet
Author: User

Have to say that Ajax is really a good thing, by its appearance so that the Web terminal technology continues to produce, comet belongs to such a technology, this technology is sometimes called reverse Ajax, sometimes called the server "push" technology, well, do not be intimidated by the shiny words, in fact, not so difficult.

Let's take a look at the wiki's explanation:

"Comet is a Web-enabled push technology that enables the server to deliver updated information to clients in real time without the need for a client to make a request, there are currently two implementations, Ajax and IFRAME streams. "

--Wikipedia

The wiki's explanation is a bit more around, so let's explain it by employing words:

In the case of a server (that is, servers, and then the specific point is the file you are currently accessing) real-time, uninterrupted to the client (browser) to send data technology, can be called Comet Technology, the current technology can be implemented in two ways, Ajax and IFRAME stream.

Or some unknown, look at the code:

  <?php  $pdo = new PDO ( ' mysql:dbname= test;host=127.0.0.1 ',  $pdo->query ( ' select * from T1 ');  $result =  $resource->fetchall ();  while (true) {if ( $result) { Span class= "Hljs-keyword" >echo  ' send data to server '; Print_r ( $result);} else{}} ?>             

Running this piece of code is one of the most streamlined versions of Comet technology.

Imagine that when the server runs this code, does the server send the data like a client (browser) like a flashy Mai? And it's not going to stop. That's called Comet, also called the server "Push", also known as reverse Ajax.

The code for the foreground request, if it is an IFRAME, is called an IFRAME stream, and if it is an AJAX request, it is called Ajax polling/long polling.

What, you still ask me what comet is? Comet is the server has been like the client to send data Ah!

Here are the specific technical implementations of comet:

Ajax polling--"timed through AJAX query server"

Uncover the mystery of Ajax long polling with plain English

Original:
1190000005032941

comet--new technology arising from the rise of Ajax technology

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.