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