Implementing Comet with php

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Comet is a programming technique that enables web servers to send data
to the client without having any need for the client to request it.

Follow the link to get detailed descripton.

Re: Implementing Comet with php

Peter victor wrote:
Quoted text here. Click to load it

Still spamming your crapsite?  If you had decent content which wasn't
stolen, you wouldn't have to do that.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: Implementing Comet with php

Peter victor wrote:
Quoted text here. Click to load it

why would anyone want a server to take control of their session anyway?

open to abuse.

Re: Implementing Comet with php

Quoted text here. Click to load it

The goal with Comet is building something resembling event-driven
AJAX.  The principle about it is the client initiates an AJAX request
on page load.  The server doesn't do anything with the open AJAX
channel and just keeps it open until something happens that the server
has to tell the client about.  When this happens the server uses the
open AJAX connection to send the notification and then closes it.  The
browser receives the message, takes whatever action is necessary and
re-establishes a new idle AJAX connection to wait for the next

This has some obvious advantages over polling.  1) the response is
immediate, whereas with polling the response doesn't occur until the
next polling cycle.  If the event happens 1 second into a 60 second
polling cycle then the client has to wait 59 seconds to find out about
it.  2) It only opens a new network connection whenever a state change
occurs.  Polling opens one every X seconds whether or not an update
has occurred.

The biggest problem with it is that HTTP requests by default have a
timeout on them, so some workarounds are needed to get around this
problem.  It also causes problems with mod_php tying up Apache child
processes.  You can get around this by using PHP in fastCGI mode, but
there's obviously a tradeoff involved.

Comet is a technique worth looking into but make sure you get the info
from someone more legit than Mr. Mpammy McSpamSpam here. Stack
Overflow might be a better starting point.

Re: Implementing Comet with php

Quoted text here. Click to load it

I believe this is the technique (if not the specific technology) used
for most JavaScript chat clients, including gChat and Facebook...

Re: Implementing Comet with php

matt wrote:
Quoted text here. Click to load it


Quoted text here. Click to load it

well there you go. Quod Erat Demonstrandum :-)

(My stupid airheaded I have a nice body so I'll flaunt it teenage niece
  on being asked on facebook whether she missed her really nice steady
decent honest boyfriind being back at college was stupid enough to say
'well there's always Julian..and Robert..giggle giggle'

At which point he replied, 'if that's your attitude, you cab fuck off')

Site Timeline