Re: [hybi] thewebsocketprotocol #28 (new): Fragmentation

Jamie Lokier <jamie@shareable.org> Wed, 24 November 2010 10:39 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 1322D28C146 for <hybi@core3.amsl.com>; Wed, 24 Nov 2010 02:39:53 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[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 DlbGO4mxw92J for <hybi@core3.amsl.com>; Wed, 24 Nov 2010 02:39:52 -0800 (PST)
Received: from mail2.shareable.org (mail2.shareable.org [80.68.89.115]) by core3.amsl.com (Postfix) with ESMTP id 2DC7128B797 for <hybi@ietf.org>; Wed, 24 Nov 2010 02:39:52 -0800 (PST)
Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from <jamie@shareable.org>) id 1PLCmQ-0006bY-S9; Wed, 24 Nov 2010 10:40:50 +0000
Date: Wed, 24 Nov 2010 10:40:50 +0000
From: Jamie Lokier <jamie@shareable.org>
To: Zhong Yu <zhong.j.yu@gmail.com>
Message-ID: <20101124104050.GY22787@shareable.org>
References: <059.5b3c3b280c1320a26d9c11c25e067e06@tools.ietf.org> <AANLkTinE95cwFQjFWc3SYsWFYSiY4mu27oQpedYJGgDJ@mail.gmail.com> <AANLkTikS+N4ZjhoRLgZv5yetD2LceWXO=KC2ksgbfySQ@mail.gmail.com> <AANLkTimaRzGObYrTCB8p7qbvqUpPPhR-uErNRaV_wPzr@mail.gmail.com> <AANLkTikzKLVT=kYKoc67rsZOaeP=0hKe8rkk7y8kuimH@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <AANLkTikzKLVT=kYKoc67rsZOaeP=0hKe8rkk7y8kuimH@mail.gmail.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
Cc: hybi <hybi@ietf.org>
Subject: Re: [hybi] thewebsocketprotocol #28 (new): Fragmentation
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: Wed, 24 Nov 2010 10:39:53 -0000

Zhong Yu wrote:
> The most important thing I think is the abstraction WS provides to app
> developers. Right now the abstraction is simple -- one message after
> another. The simplicity is a good thing, if it is compromised I don't
> know what websocket is supposed to be any more.

Right now, WS provides *two* abstractions: The one to app developers,
and the one over TCP.

Some of us believe they *should not be the same* due to network
engineering issues *because that makes the app developer's job easier*.

Right now, the "simplicity" of WS means *robust* apps need to
implement half of TCP in Javascript on the client, which is not a good
sign.  (For example the "tic tac toe" example, which is supposed to be
simple, can lock up on real networks: No more moves when a TCP is
silently dropped.  A HTTP equivalent doesn't have this problem.)

Why do you think the two abstractions should be the same?

HTTP's app abstraction is quite different from its wire abstraction,
and that separation has worked extremely well for everyone.

> Let's just kill fragments and don't even think about any advanced
> features that depend on it. Every message stays in one frame, even
> ones with unknown lengths.

Technical question: How would you send a binary message with unknown
length, in a single frame without fragments?

That said, I'm not sure why we need to support messages with unknown
lengths in advance in the simplest protocol level anyway.  Is there a
use case for control frames such as graceful close or error indication
in the middle of a message?

The use cases which come to my mind are: Keepalives - those are
desirable in th middle of a large message, if the message is being
generated slowly; and graceful close/error indicator, in the case of
WS being forwarded over a proxy.  But neither of those behaviours are
in the simplest protocol.

Imho, what we do need to do, though, is make it clear what proxies are
supposed to do when forwarding a large or unbounded-length WS
message...  Forward every byte as soon as they receive it, buffer
whole messages if they so wish, or something between?  The first is
inefficient over TCP (it can make unnecessary packets and unnecessary
delays), and the second would lead to breakage because proxy behaviour
would be different from non-proxy behaviour.  Right now, proxies doing
CONNECT implement the first.

-- Jamie