[Seaside] Comet
Colin Putney
cputney at wiresong.ca
Thu Oct 15 18:03:53 UTC 2009
On 15-Oct-09, at 10:50 AM, Robert Sirois wrote:
> Am I correct in my understanding that Comet only works when
> something changes serverside? Say, one client increments a counter
> (as per the example), then the server pushes the new value to all
> connected clients.
>
> Is there a way that Comet can be set up to push information every so
> often? This way being independent from any user input.
If you want to do periodic updates, I would recommend having the
clients poll, rather than using Coment.
Comet is good for the case where you have events occurring at
unpredictable times and you need to push notification of them out to
all clients. In this case polling, is inefficient because you're
either wasting resources by checking for events when there aren't any,
or introducing latency when there is a new event but you're waiting
for the next poll. There's a trade-off between efficiency and latency
- the more frequently you poll the more resources you waste, but the
less frequently you poll, the more latency you introduce. Comet solves
this by using fewer HTTP requests, and sending events as they occur.
If I understand your situation correctly, you want to update clients
on a regular schedule. It's not a counter so much as a clock that's
being updated. In this case, polling is quite efficient. You know when
there will be new data, so you just have to schedule the clients to
poll at those times - high efficiency and low latency.
Colin
More information about the seaside
mailing list