[hybi] how do we move forward on agreeing on framing?

John Tamplin <jat@google.com> Thu, 19 August 2010 05:28 UTC

Return-Path: <jat@google.com>
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 02BA03A683C for <hybi@core3.amsl.com>; Wed, 18 Aug 2010 22:28:21 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -103.591
X-Spam-Level:
X-Spam-Status: No, score=-103.591 tagged_above=-999 required=5 tests=[AWL=-0.029, BAYES_40=-0.185, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
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 F+ORk7ju9O8i for <hybi@core3.amsl.com>; Wed, 18 Aug 2010 22:28:18 -0700 (PDT)
Received: from smtp-out.google.com (smtp-out.google.com [74.125.121.35]) by core3.amsl.com (Postfix) with ESMTP id 71B663A6867 for <hybi@ietf.org>; Wed, 18 Aug 2010 22:28:17 -0700 (PDT)
Received: from hpaq1.eem.corp.google.com (hpaq1.eem.corp.google.com [172.25.149.1]) by smtp-out.google.com with ESMTP id o7J5SpOl018378 for <hybi@ietf.org>; Wed, 18 Aug 2010 22:28:51 -0700
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1282195731; bh=1weu+3KGcnOIfEMqfbhkYUrEgss=; h=MIME-Version:From:Date:Message-ID:Subject:To:Content-Type; b=P6RfPmrf0QOEM79Wn8/0vtREwOuWp2HaMWkLCruJuFFR4PNJDRen1VzcP2BEvYPtt 947mLPjbzezukirxSDNAw==
DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=mime-version:from:date:message-id:subject:to:content-type:x-system-of-record; b=tZv6W2aPr5eVSOoSQgJgNQOfYCV1oFrw6EW8zUeXaEfRu0kus2ISsDvF55e5iJSiI mGWA6Ij0vmT2pLbDbDSew==
Received: from gxk2 (gxk2.prod.google.com [10.202.11.2]) by hpaq1.eem.corp.google.com with ESMTP id o7J5SmKL004064 for <hybi@ietf.org>; Wed, 18 Aug 2010 22:28:49 -0700
Received: by gxk2 with SMTP id 2so657243gxk.34 for <hybi@ietf.org>; Wed, 18 Aug 2010 22:28:48 -0700 (PDT)
Received: by 10.150.195.11 with SMTP id s11mr1236934ybf.363.1282195728183; Wed, 18 Aug 2010 22:28:48 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.151.60.3 with HTTP; Wed, 18 Aug 2010 22:28:28 -0700 (PDT)
From: John Tamplin <jat@google.com>
Date: Thu, 19 Aug 2010 01:28:28 -0400
Message-ID: <AANLkTineuhvGsC_vca6AiAX8OmHdkE-7s7rA1DQtjtMm@mail.gmail.com>
To: Hybi <hybi@ietf.org>
Content-Type: multipart/alternative; boundary="000e0cd4852ce9426c048e2674fb"
X-System-Of-Record: true
Subject: [hybi] how do we move forward on agreeing on framing?
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, 19 Aug 2010 05:28:21 -0000

There have been various discussions about various proposals, and to be sure
there will be no proposal that everyone is happy with.  What can we do to
come to some consensus on something that is acceptable for the base protocol
so we can move forward?

To me, I think the following things are critical:

   - fragmentation support - this has been accepted as a requirement without
   much dissension when it was declared that we achieved consensus on it, and
   if we don't have support for it in the base protocol it will greatly
   complicate efforts for certain extensions a number of people think will be
   important in the future, such as multiplexing
   - low overhead for small frames - as previously indicated, real-world
   WebSocket apps do make use of a substantial percentage of small messages,
   and when compression is added the percentage grows to an overwhelming
   majority.  Sure, there will be some WebSocket apps which won't get any
   benefit from small frames, but that shouldn't remove the capability from
   those that do.
   - we can't afford to decide on the extension format now - given the rate
   of building consensus, we won't ever finish the base protocol if we have to
   define that now.  That means anything that is critical to support in the
   base protocol, such as fragmentation or (if we decide it is important for
   implementations of the base protocol) the total message length, cannot be
   defined in an extension.
   - we need to leave our options open for extensibility - since we don't
   yet agree on exactly how the protocol should be extended or exactly what
   facilities such extensions may need, we need to have some flexibility for
   how those extensions can be represented

Does anyone disagree with these points?

So here is another attempt at incorporating feedback to try and get
something which could gain consensus as the framing protocol:

   - MORE - 1 bit - if set, this is not the final frame of the message
   - TML - 1 bit - if set, the total message length is included (which is
   not required to be on the first frame, and if repeated overrides earlier
   values so it may be used as an estimate for dynamic content)
   - Reserved - 2 bits - must be 0 except for private use
   - Opcode - 4 bits - 0=Continuation, 1=Control, 2=Text, 3=Binary,
   4-11=Reserved for future assignment, 12-15=Reserved for private use
   - Reserved - 1 bit - must be 0
   - Length - 7 bits - payload length in octets; if 127, then there is an
   extended length
   - Extended length - 8 bytes - payload length in octets (high bit must be
   0 for ease of use with languages without an unsigned data type), present
   only if Length=127
   - Total Message Length - 8 bytes - total message length in octets (high
   bit must be 0 as above), present only if TML=1
   - Payload - (Extended) Length bytes - payload, interpreted as defined by
   the Opcode

This addresses the concern about requiring the total message length to be in
the first frame or to be present at all if it is unknown.  It allows us to
use a bit to indicate extension data is present, or to define extensions by
new opcodes (and to grow the opcode field if necessary by using adjacent
reserve bits).  Some bits are available for direct assignment, such as if we
find frame-by-frame compression a useful future extension. It also cleans up
room for confusion in the previous proposal where you could change opcodes
between fragments.

Example messages:

   - MORE=0,TML=0,Opcode=Text, Length=12, Payload="Hello world!" -
   single-frame text message



   - MORE=1,TML=1,Opcode=Text, Length=5, MsgLength = 12, Payload="Hello" -
   first frame of fragmented message
   - MORE=0,TML=0,Opcode=Continuation, Length=7, Payload=" world!" - final
   frame of fragmented message



   - MORE=1,TML=1,Opcode=Text, Length=127, ExtLength=4096, MsgLength=16000,
   Payload=... - first frame of dynamically generated message, with estimated
   message length
   - MORE=1,TML=0,Opcode=Continuation, Length=127,
   ExtLength=4096,Payload=... - several frames delivering dynamic content
   - MORE=1,TML=1,Opcode=Continuation, Length=127, ExtLength=4096,
   MsgLength=14781, Payload=... - sender now knows length of dynamic content
   and sends it
   - MORE=0,TML=0,Opcode=Continuation, Length=127, ExtLength=2493,
   Payload=... - final frame of message

Extension Possibilities:

   - if we decide creating new opcodes for extensions, which then nest the
   next layer of extension within their payload data, we have room to allocate
   additional opcodes, and we can grow the opcode space if we need to
   - if we decide to include per-frame extension data, we can allocate a
   reserved bit to indicate the presence of an extension length which describes
   the length of extension data
   - if we decide to include per-frame compression, we can allocate a
   reserved bit to indicate that this frame is compressed
   - we can allocate new control frame types

Is this something we can all get behind, even if it doesn't do everything we
want, in the interest of getting something useful done soon?  If not, what
specific changes would be necessary for you to agree?

-- 
John A. Tamplin
Software Engineer (GWT), Google