Re: [hybi] frame length encoding

Salvatore Loreto <salvatore.loreto@ericsson.com> Sun, 22 August 2010 19:44 UTC

Return-Path: <salvatore.loreto@ericsson.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 08D1A3A6952 for <hybi@core3.amsl.com>; Sun, 22 Aug 2010 12:44:15 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -104.68
X-Spam-Level:
X-Spam-Status: No, score=-104.68 tagged_above=-999 required=5 tests=[AWL=-0.381, BAYES_00=-2.599, MANGLED_TIME=2.3, 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 0vyL2PUVfWrB for <hybi@core3.amsl.com>; Sun, 22 Aug 2010 12:44:12 -0700 (PDT)
Received: from mailgw10.se.ericsson.net (mailgw10.se.ericsson.net [193.180.251.61]) by core3.amsl.com (Postfix) with ESMTP id 672873A688B for <hybi@ietf.org>; Sun, 22 Aug 2010 12:44:12 -0700 (PDT)
X-AuditID: c1b4fb3d-b7b90ae00000278d-5c-4c717e2d4da2
Received: from esealmw126.eemea.ericsson.se (Unknown_Domain [153.88.253.124]) by mailgw10.se.ericsson.net (Symantec Mail Security) with SMTP id 06.5F.10125.D2E717C4; Sun, 22 Aug 2010 21:44:45 +0200 (CEST)
Received: from esealmw126.eemea.ericsson.se ([153.88.254.174]) by esealmw126.eemea.ericsson.se with Microsoft SMTPSVC(6.0.3790.3959); Sun, 22 Aug 2010 21:44:28 +0200
Received: from mail.lmf.ericsson.se ([131.160.11.50]) by esealmw126.eemea.ericsson.se with Microsoft SMTPSVC(6.0.3790.3959); Sun, 22 Aug 2010 21:44:27 +0200
Received: from nomadiclab.lmf.ericsson.se (nomadiclab.lmf.ericsson.se [131.160.33.3]) by mail.lmf.ericsson.se (Postfix) with ESMTP id EA9A9253E; Sun, 22 Aug 2010 22:44:27 +0300 (EEST)
Received: from nomadiclab.lmf.ericsson.se (localhost [127.0.0.1]) by nomadiclab.lmf.ericsson.se (Postfix) with ESMTP id B188D4FD0B; Sun, 22 Aug 2010 22:44:27 +0300 (EEST)
Received: from Salvatore-Loretos-MacBook-Pro.local (localhost [127.0.0.1]) by nomadiclab.lmf.ericsson.se (Postfix) with ESMTP id 029B54ECF5; Sun, 22 Aug 2010 22:44:26 +0300 (EEST)
Message-ID: <4C717E1A.5000404@ericsson.com>
Date: Sun, 22 Aug 2010 21:44:26 +0200
From: Salvatore Loreto <salvatore.loreto@ericsson.com>
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6
MIME-Version: 1.0
To: Scott Ferguson <ferg@caucho.com>
References: <AANLkTimKbmcpgx8k0uXUWvCO=8w9pPrtV=3y4qh6363k@mail.gmail.com> <20100820192927.GA32620@1wt.eu> <4C6EEA55.2050205@hs-weingarten.de> <AANLkTinHqxUOZaVANFpC52t8FfgNw2L5_A-s9Az3Fm7p@mail.gmail.com> <AANLkTinvkxMP8FYz9xjDu_Kt9FfzYotgsqXUDB4MZMEo@mail.gmail.com> <AANLkTim3KRq1arso7wN_b+1TH3sWabYW6uFu7AbYw6-P@mail.gmail.com> <AANLkTikhhajho895WyEoJMwMk9GJ98kA0Mjy5qr4apC8@mail.gmail.com> <AANLkTi=kdk6BRvza_7bpoLNTFzUkjcRRijGLMe_NGXZV@mail.gmail.com> <AANLkTi=VE298Tg+qyfufhzMswE5pBxtPZhA0t2k=sf2A@mail.gmail.com> <4C717048.5020309@ericsson.com> <4C717B28.4070009@caucho.com>
In-Reply-To: <4C717B28.4070009@caucho.com>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: ClamAV using ClamSMTP
X-OriginalArrivalTime: 22 Aug 2010 19:44:28.0081 (UTC) FILETIME=[6E8E5210:01CB4232]
X-Brightmail-Tracker: AAAAAA==
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] frame length encoding
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: Sun, 22 Aug 2010 19:44:15 -0000

On 8/22/10 9:31 PM, Scott Ferguson wrote:
> Salvatore Loreto wrote:
>    
>> On 8/21/10 9:59 PM, Pieter Hintjens wrote:
>>      
>>> On Sat, Aug 21, 2010 at 9:34 PM, John Tamplin<jat@google.com>   wrote:
>>>
>>>
>>>        
>>>> The main difference between #0 and #1 is that #0 uses one of three
>>>> reserved
>>>> bits.  They are easy to spend, but then when we find out we need
>>>> them it
>>>> becomes much more expensive to get them back.
>>>>
>>>>          
>>> Indeed.  Adding another 8 reserved bits in the header does not seem
>>> wasteful.
>>>
>>>        
>> (as individual)
>>
>> I agree on the fact that with the fact that adding an extra byte to
>> the WebSocket header would
>> cost very little also for very small payload.
>>
>> I don't understand because 4bytes basic header (+length field
>> +payload) as defined in
>> http://tools.ietf.org/html/draft-ietf-core-coap-01#section-3.1
>> is good for constrained devices and constrained networks: btw
>> constrained devices are the one usually just exchanging 1byte payload
>>
>> and we can not define a 2byte basic header (+length field +payload)
>> for WebSocket, reducing the complexity present in the previous proposals
>> using 1 or 2 bits to indicate the length header,
>> and also providing more room (bits) for future extensions (actually we
>> could also think to use 2bits for version the protocol)
>>      
>
> Something like the following?
>
>   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
> +-+-+---+-------+---------------+
> |F|T|LEN|OPCODE | reserved(8)   |
> |I|M|   |       |               |
> |N|L|   |       |               |
> +-+-+---+-------+---------------+
>    
(again as individual)

Hi Scott

almost, what I had in mind was

  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-+-+---+-+-------+--------------+
|F|T|LEN|R|OPCODE | reserved(7)  |
|I|M|   |E|       |              |
|N|L|   |S|       |              |
+-+-+---+-+-------+--------------+

in this way we have the possibility to add 1 extra bit to OPCODE in the 
case we will run out of it

> LEN: 00 = 1 byte length
>       01 = 2 byte length
>       10 = reserved (or 4 byte)
>       11 = 8 byte length
>
> It might also be possible to define 00 to use the reserved byte for an
> ultra-compact header, or 00 could be ultra-compact, and 01 could be the
> normal 1 byte after the reserved and 10 be 2 byte.
>
> LEN: 00 = 0 byte length (uses reserved byte)
>       01 = 1 byte length
>       10 = 2 byte length
>       11 = 8 byte length
>    
+1
> (For versioning, a hello opcode might be better than taking up frame
> bits, and a hello opcode would also allow digest-authentication
> credentials to piggyback on the handshake replacing the 8 random bytes,
> which is an idea I'd like to bring up when we get to discussing the
> handshake because I'd love to save a roundtrip when authenticating
> non-browser clients.)
>    

For versioning I don't have a strong opinion, it was just an example of 
the fact that we need enough room (bits) for extansions

-- 
Salvatore Loreto
www.sloreto.com