Good day! Faced the need to implement Comet technology instead of the usual AJAX requests back and forth every second ...

The whole day did not depart from the company, trying to figure out, reading articles and all sorts of examples. Sometimes it almost worked. But the principle is so normal and did not understand, in practice it does not work

Please explain the principle of the work of the notorious Comet, preferably with some simple example, otherwise I’m trying to write a working script, and something works wrong anyway ...

2 answers 2

Blockquote I don't think it's time to commet. Not all browsers support it! If it works, then only for one or two browsers, for the rest, ajax will have to be used. And so you can read in the direction of node.js

At the expense of a pair of browsers, I’m willing to bet, in each browser you can implement a similar data transfer, you can read everything about COMET technology here , there are also examples of implementing client scripts.

On the server, you can also use js, a good example I saw in Habré , it is well described how online chat is implemented.

    A good example on ASP.NET MVC Roll Your Own MVC 3 Long Polling Chat Site , Demo (Open in 2 browsers and chat)