[uf-rest] AHAH and delay: "push" as "lazy pull"

Kevin Marks kmarks at mac.com
Mon Nov 28 15:37:14 PST 2005


On Nov 28, 2005, at 1:57 PM, Dr. Ernie Prabhakar wrote:

> Hi Ryan,
>
> On Nov 27, 2005, at 9:20 AM, Ryan King wrote:
>>>
>>> However, my hypothesis is that you can also implement "push" as 
>>> "lazy pull."
>>
>> I'm pretty sure I've seen this hypothesis proven already.
>
> I know Rohit proposed it a while ago, as Roy  alludes to here:
>
> http://groups.yahoo.com/group/rest-discuss/message/5266
>
> I'm just not (yet) sure of how generally applicable that is

The underlying 'pending http' model is widely used. In particular, it 
is how DAAP (the iTunes sharing protocol) handles synchronising 
playlist changes and detecting disconnects -(you need no traffic to 
maintain a pending TCP connection, but you do get a teardown message 
when it goes).

I also helped Greg Elin build this kind of protocol for his network 
chat application over XMLHTTPRequest.

The key to doing it reliably is to use a sequence number in the 
requests (not a timestamp, as that has potential skew and races), so 
the server knows what you have already got. Also, you should have 
exponential backoff and retry on timeouts and other dropped connection 
errors.

A simple chat app using this might be an interesting bit of sample code.



More information about the microformats-rest mailing list