Re: [hybi] Addressing Minimal Events

Jamie Lokier <jamie@shareable.org> Mon, 13 April 2009 17:23 UTC

Return-Path: <jamie@shareable.org>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id C4B2D3A6D36 for <hybi@core3.amsl.com>; Mon, 13 Apr 2009 10:23:06 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.417
X-Spam-Level:
X-Spam-Status: No, score=-4.417 tagged_above=-999 required=5 tests=[AWL=-1.818, BAYES_00=-2.599]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tqMIukNOvmwL for <hybi@core3.amsl.com>; Mon, 13 Apr 2009 10:23:06 -0700 (PDT)
Received: from mail2.shareable.org (mail2.shareable.org [80.68.89.115]) by core3.amsl.com (Postfix) with ESMTP id 71BEB3A69AE for <hybi@ietf.org>; Mon, 13 Apr 2009 10:23:03 -0700 (PDT)
Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from <jamie@shareable.org>) id 1LtPtE-0008MZ-Vz; Mon, 13 Apr 2009 18:24:12 +0100
Date: Mon, 13 Apr 2009 18:24:12 +0100
From: Jamie Lokier <jamie@shareable.org>
To: Mark Lentczner <markl@lindenlab.com>
Message-ID: <20090413172412.GA31677@shareable.org>
References: <49DEF171.4080506@mozilla.com> <c5b3a7130904100019ged7ec45o749213482f12c878@mail.gmail.com> <op.usaa24vt64w2qv@anne-van-kesterens-macbook.local> <170C0E82-633A-4CA9-B26E-38015BFC7C0D@lindenlab.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <170C0E82-633A-4CA9-B26E-38015BFC7C0D@lindenlab.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
Cc: hybi@ietf.org
Subject: Re: [hybi] Addressing Minimal Events
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 13 Apr 2009 17:23:06 -0000

Mark Lentczner wrote:
> What I'm wondering is: How does one, given a Minimal, Event style  
> protocol, handle when there are two or more widgets on the page that  
> need updates? The home page view on Facebook, for example, has at  
> least four separate areas being live-updated.

I imagine most systems use a multiple-subscriber pattern:

    The web client sends 4 comet-style requests for updates (one per
    widget), sometimes combining those into a single HTTP request
    carrying 4 comet-style encoded requests, sometimes using 4
    separate HTTP requests.  At most one of the HTTP requests will be
    a "long GET", waiting for updates to any of the widgets, or the
    long GET may be a separate request.

And I imagine a few use a single-subscriber pattern:

    The web client sends 1 request for updates for all the widgets,
    with the web server knowing which 4 widgets are present on that
    page.  That request is probably the same "long GET" (or long POST)
    which waits for updates to any of the widgets.

In both cases, events come back over a single long GET/POST (or
polling request) and are dispatched to the appropriate widget, by
whatever ad hoc addressing scheme.

For my own pages I'm combining multiple "group subscriptions" into a
hierarchy of address/etag pairs.  One compact request is enough for
the whole page if the server has that state in its group-subscription
cache, but it drops to encoding multiple requests when the server's
cache no longer has that information, or when the page is dynamically
modified to contain a different set of widgets.

My scheme is efficient when you have hundreds/thousands of widgets,
such as a table of information where every cell is individually
tracking some information, a screen full of sliders, and line/bar
graphs where you might update just a subset of the data from time to
time.  The etags allow the data to be present in the initially fetched
page and updated only when needed.

-- Jamie