Re: [hybi] Framing take IV

Jamie Lokier <jamie@shareable.org> Thu, 05 August 2010 02:11 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 A78913A6839 for <hybi@core3.amsl.com>; Wed, 4 Aug 2010 19:11:08 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.369
X-Spam-Level:
X-Spam-Status: No, score=-2.369 tagged_above=-999 required=5 tests=[AWL=-0.070, BAYES_00=-2.599, MIME_8BIT_HEADER=0.3]
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 wDYt2dOukfAm for <hybi@core3.amsl.com>; Wed, 4 Aug 2010 19:11:07 -0700 (PDT)
Received: from mail2.shareable.org (mail2.shareable.org [80.68.89.115]) by core3.amsl.com (Postfix) with ESMTP id F27203A699A for <hybi@ietf.org>; Wed, 4 Aug 2010 19:11:06 -0700 (PDT)
Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from <jamie@shareable.org>) id 1Ogpvg-0006Uc-MJ; Thu, 05 Aug 2010 03:11:32 +0100
Date: Thu, 05 Aug 2010 03:11:32 +0100
From: Jamie Lokier <jamie@shareable.org>
To: "Ian Fette (イアンフェッティ)" <ifette@google.com>
Message-ID: <20100805021132.GZ27827@shareable.org>
References: <AANLkTinyrDoG5d_Ur6HVRy=SgMPjLzJtpJ++Ye=1DQdj@mail.gmail.com> <Pine.LNX.4.64.1008040050040.5947@ps20323.dreamhostps.com> <28A6543A-5CA6-42B7-8D2E-F5511EE20008@apple.com> <4C58C2F6.8050608@caucho.com> <Pine.LNX.4.64.1008040132190.5947@ps20323.dreamhostps.com> <4C58C4C8.5020900@caucho.com> <Pine.LNX.4.64.1008040139520.5947@ps20323.dreamhostps.com> <AANLkTinp7UmROSCRSvuj_AKcMT4OnhWebPCD-z_60LZZ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <AANLkTinp7UmROSCRSvuj_AKcMT4OnhWebPCD-z_60LZZ@mail.gmail.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
Cc: hybi@ietf.org
Subject: Re: [hybi] Framing take IV
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: Thu, 05 Aug 2010 02:11:09 -0000

Ian Fette (イアンフェッティ) wrote:
> 
>    On Tue, Aug 3, 2010 at 9:13 PM, Ian Hickson <[1]ian@hixie.ch> wrote:
> 
>    On Tue, 3 Aug 2010, Scott Ferguson wrote:
>    > Ian Hickson wrote:
>    > > On Tue, 3 Aug 2010, Scott Ferguson wrote:
>    > > > > Â  I agree. I can't see any benefit to fragmentation over a
>    > > > > variable-size length field for an initial version without
>    > > > > multiplexing. If the variable-size length field is
>    well-designed,
>    > > > > then in the common case where the message size is small it
>    will
>    > > > > only cost one extra branch to read the length. In the rare
>    case
>    > > > > where the message size is large, a variable-size length is
>    easier
>    > > > > to deal with than reassembling fragments, and easier on the
>    > > > > sending side too.
>    > > >
>    > > > Some of us don't have infinite memory when sending messages.
>    > >
>    > > Why do you need infinite memory?
>    >
>    > Because we don't know the length of dynamically produced content
>    until
>    > the dynamic process is complete. That's why HTTP added chunking.
> 
>      Is this a common case we should expect? What are the use cases for
>      this?
>      If this is a rare occurence, then it's probably simplest to support
>      this
>      at the application layer - nothing stops anyone from having a
>      subprotocol
>      that defines the first byte/character of each message as being a
>      "has continuation" byte.
>      If this is a common occurance, then we'll be able to tell when
>      people find
>      themselves often implementing this at the application layer, and
>      then we
>      can easily add it at the WebSocket layer at that time (in a few
>      months).
>      We don't need to reserve bits specifically for it today.
> 
>    We're adding a voice input capability, and we want to start sending
>    the user's voice up as soon as they start speaking, without waiting
>    for the recording to be finished so that we can start backend
>    processing. Yes, we could probably break it into multiple messages,
>    but given that semantically it's a single message, this is a case
>    where we would want to start sending data before knowing its length.
>    Ditto for hooking up a video camera and sending that data to some sort
>    of web service.

Ah, not really.

That one is better following Ian Hixie's method of application-visible
concatenation.  The JS API is defined to not deliver a message until
the whole message is received (even if we specify split-message chunks
in the protocol), so a JS application would not see the voice data
until a message boundary.

While other clients can use different APIs, we should try to match the
behavioural characteristics of the JS API as closely as possible for
the sake of interoperability.

There is another important reason: Intermediary behaviour isn't well
defined yet, but it would not be unreasonable for an active
intermediary to arbitrarily delay parts of a partially received
message, for example to compress the whole message (or large parts),
or forward more efficiently.

Basically, message boundaries are the only guaranteed delivery points,
and as the voice/camera application needs to guarantee regular
deliveries, it should mark those delivery points explicitly by making
them message boundaries, not chunk boundaries.

-- Jamie