And incidentally, I wish to apply it to Apache. Is it feasible?
Comet is lengthy-polling where client transmits a request and waits for that response in the server. The server queues the request and when it will get the up-to-date results. It transmits the reaction to the customer.
So essentially all that you should do would be to send an
.ajax request towards the server and employ the
onSuccess callback to handle the coming back the information. The
onSuccess callback won't be known as unless of course the server will get the up-to-date data.
Nothing really fancy in the client-side. The particular game is around the server side to queue the demands after which respond accordingly.
Have a look only at that answer detailed code sample > Simple "Long Polling" example code?
If you're only doing lengthy polling then jQuery works fine. However, jQuery doesn't expose a readyState === 3 event, so there's no built-in method of getting data because it is streaming if that's the direction you need to go.
[Edit] This is actually the bug, #1172
Also it appears like they added the functionality in 1.5, utilizing a Prefilter
So yes, that you can do all of the comet stuff with jQuery now :)
i've made the jQuery version of comet before, this is exactly what i'd done:
var comet = Opera...) comet.connection = $('<iframe>') comet.connection.attr('id', 'comet_iframe') comet.connection.css( ) //comet.iframediv = $('<iframe>') comet.connection.attr('src', 'backend.php') //comet.connection.append(comet.iframediv) $('body').append(comet.connection) , // this function is going to be known as from after sales.php printServerTime: function (time) , onUnload: function() $(window).load(comet.initialize) .unload(comet.onUnload)
i'd taken the code quickly that page and managed to get jquery ^_^
there's a wordpress plugin i've come across, do this? http://code.google.com/p/jquerycomet/