Re: [hybi] Frame size

Greg Wilkins <gregw@webtide.com> Sat, 17 April 2010 07:19 UTC

Return-Path: <gregw@webtide.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 D854A3A69E1 for <hybi@core3.amsl.com>; Sat, 17 Apr 2010 00:19:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.351
X-Spam-Level:
X-Spam-Status: No, score=-0.351 tagged_above=-999 required=5 tests=[AWL=-0.352, BAYES_50=0.001]
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 86j95VTnseX6 for <hybi@core3.amsl.com>; Sat, 17 Apr 2010 00:19:15 -0700 (PDT)
Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.158]) by core3.amsl.com (Postfix) with ESMTP id C2C9B3A6AA1 for <hybi@ietf.org>; Sat, 17 Apr 2010 00:18:43 -0700 (PDT)
Received: by fg-out-1718.google.com with SMTP id 22so67533fge.13 for <hybi@ietf.org>; Sat, 17 Apr 2010 00:18:32 -0700 (PDT)
Received: by 10.103.69.2 with SMTP id w2mr1715379muk.18.1271488712118; Sat, 17 Apr 2010 00:18:32 -0700 (PDT)
Received: from [192.168.0.100] (host116-234-static.43-88-b.business.telecomitalia.it [88.43.234.116]) by mx.google.com with ESMTPS id e9sm17340889muf.40.2010.04.17.00.18.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 17 Apr 2010 00:18:31 -0700 (PDT)
Message-ID: <4BC960C5.1010906@webtide.com>
Date: Sat, 17 Apr 2010 09:18:29 +0200
From: Greg Wilkins <gregw@webtide.com>
User-Agent: Thunderbird 2.0.0.24 (X11/20100411)
MIME-Version: 1.0
To: Ian Hickson <ian@hixie.ch>
References: <8B0A9FCBB9832F43971E38010638454F03E3F313ED@SISPE7MB1.commscope.com> <Pine.LNX.4.64.1004161940180.751@ps20323.dreamhostps.com>
In-Reply-To: <Pine.LNX.4.64.1004161940180.751@ps20323.dreamhostps.com>
X-Enigmail-Version: 0.95.7
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit
Cc: Hybi <hybi@ietf.org>, "Thomson, Martin" <Martin.Thomson@andrew.com>
Subject: Re: [hybi] Frame size
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: Sat, 17 Apr 2010 07:19:18 -0000

Ian Hickson wrote:
> On Fri, 16 Apr 2010, Thomson, Martin wrote:
>> Proposal:
>>
>>  - Frame size is indicated up front.
> 
> This seems incompatible with the requirement that we not expose amateur 
> programmers to the complications of measuring UTF-8 strings.

I'm not this is an agreed requirement.

At the 77 meeting, we asked you to put this into the form of some
proposed text for the requirements document.  We can then discuss
and if there is consensus it can be added as a requirement.

However, I maintain my belief that amateur programmers will
most likely be using frameworks, libraries and servers that
implement the protocol for them.


>>  - Frame size be strictly limited (2 octets should suffice).
>>  - Sub-protocol needed if messages are larger than the max frame.
> 
> This seems like it would make the API highly unpredictable. For example, 
> it would mean that you could transmit 65,536 characters if they were the 
> character "X", but only 21,845 if they were the character U+263A.

Frames are entirely different entities to messages.
The application API deals with message - which if we have a fixed
frame size, may be fragmented and reassembled.

If we did agree on a small fixed frame size, the fragmentation
and aggregation would be an obvious extension.  We may or may not
decide that all clients/servers should implement it.   I think
optional would be best, as browsers are capable enough to implement
the option, but small special purpose clients/servers could be developed
without that complication.


> That 
> would be very confusing. Similarly, if we add compression, it would mean 
> that how many bytes you could pass in the send() method would depend on 
> how well it compressed. This would result in a very bad programming 
> experience, especially for anyone new to this kind of thing. (I would 
> expect most subprotocols to be ridiculously primitive; asking amateurs to 
> figure out chunking mechanics is non-trivial, especially if they have to 
> work out where to split a UTF-16 string as exposed in JS, before it is 
> converted to UTF-8 and compressed, which is what matters for deciding what 
> will fit in the frame.)

The bad programming experience is a result of directly exposing a
protocol entity (frame of binary data) to the application programmer.

The solution is to abstract the application programmer away from
the protocol. They send/receive arbitrary length messages in characters,
the protocol then arranges to encode those as 1 or more binary frames,
with or without compression, with or without aggregation etc.

At the other end, the character message is reassembled (or streamed
to disk if it is large etc).

>> Binary frames isolate user-space (the payload) from the framing layer.  We had this discussion in the meeting (c.f. Pete Resnick's comments).  Thus, 
>>  - binary frames are easier to process (intermediaries don't have to inspect every octet)
>>  - kinder on implementations (framing component does not depend on UTF-8 component)
>>  - isolates framing layer from the bugs of higher layers
> 
> If we were designing a protocol for experts, I would completely agree. 


I believe the vast majority of people here agree with the view that
the target audience for websocket is Browser developers and Server Developers.
ie expert developers.

I know you do not agree with this, but I do not believe that you have made
your case that amateur programmers are the prime target for this protocol.

Have a look at http://en.wikipedia.org/wiki/Web_Sockets - there are
plenty of implementations listed there, which are written by expert
programmers.

Again, if you believe that targeting amateur programmers is a requirement
for this working group, can you propose some text to that effect
to add to the requirements document.   If you make your case, then
it can be included.





regards