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

John Tamplin <jat@google.com> Mon, 22 November 2010 19:08 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 AC18F28C108 for <hybi@core3.amsl.com>; Mon, 22 Nov 2010 11:08:45 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -109.864
X-Spam-Level:
X-Spam-Status: No, score=-109.864 tagged_above=-999 required=5 tests=[AWL=0.112, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-8, 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 S8zs8arWR7rG for <hybi@core3.amsl.com>; Mon, 22 Nov 2010 11:08:44 -0800 (PST)
Received: from smtp-out.google.com (smtp-out.google.com [74.125.121.35]) by core3.amsl.com (Postfix) with ESMTP id 71E7428C0CE for <hybi@ietf.org>; Mon, 22 Nov 2010 11:08:44 -0800 (PST)
Received: from wpaz29.hot.corp.google.com (wpaz29.hot.corp.google.com [172.24.198.93]) by smtp-out.google.com with ESMTP id oAMJ9bR6018707 for <hybi@ietf.org>; Mon, 22 Nov 2010 11:09:37 -0800
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1290452979; bh=UvYsku7nNOaagTnb8kbLTEGatR0=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=TiDe7JmMRcMDAPA1ZeHrl0/Xl/g4usi40YSW1MVWK+jIkIX3ofEBiDuZ5gmf9Ty/H 35Uu2K9vphJ1tKJDLAYGg==
Received: from yxl31 (yxl31.prod.google.com [10.190.3.223]) by wpaz29.hot.corp.google.com with ESMTP id oAMJ8aFl009419 for <hybi@ietf.org>; Mon, 22 Nov 2010 11:09:36 -0800
Received: by yxl31 with SMTP id 31so170358yxl.18 for <hybi@ietf.org>; Mon, 22 Nov 2010 11:09:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=HwPMwqzIzTrnfGa9DaKRHfu/J61BzssNBMx2HEIBe+Q=; b=AXBTRI0trWHFDuRAW+tiFZPgsPxGeWFnN956rej/UDEak1hW0soFsMKbanCk9A/u0X zsnzmL0iC1uHOPUd3/AA==
DomainKey-Signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=aaQ/kzH4umQeXAFQfahxYRK2TG7RwjAf41o4RLjonUtXN8JdW8puVAlqgcU56V39CY HoYM6pLvWF7+7PmRMbBA==
Received: by 10.151.158.12 with SMTP id k12mr9686618ybo.377.1290452975583; Mon, 22 Nov 2010 11:09:35 -0800 (PST)
MIME-Version: 1.0
Received: by 10.150.54.13 with HTTP; Mon, 22 Nov 2010 11:09:15 -0800 (PST)
In-Reply-To: <AANLkTinE95cwFQjFWc3SYsWFYSiY4mu27oQpedYJGgDJ@mail.gmail.com>
References: <059.5b3c3b280c1320a26d9c11c25e067e06@tools.ietf.org> <AANLkTinE95cwFQjFWc3SYsWFYSiY4mu27oQpedYJGgDJ@mail.gmail.com>
From: John Tamplin <jat@google.com>
Date: Mon, 22 Nov 2010 14:09:15 -0500
Message-ID: <AANLkTikS+N4ZjhoRLgZv5yetD2LceWXO=KC2ksgbfySQ@mail.gmail.com>
To: Zhong Yu <zhong.j.yu@gmail.com>
Content-Type: multipart/alternative; boundary="00151750dd4235830a0495a8ff43"
X-System-Of-Record: true
Cc: hybi@ietf.org, sm+ietf@elandsys.com
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: Mon, 22 Nov 2010 19:08:45 -0000

On Mon, Nov 22, 2010 at 1:32 PM, Zhong Yu <zhong.j.yu@gmail.com> wrote:

> I think the answers to this question depend on specific programming
> models, therefore they are best addressed by applications/frameworks.
> WS protocol doesn't have to support streaming - that's the job of
> frameworks. A single layer shouldn't mix streams and messages. (So we
> have streaming framework, on top of WebSocket frames, on top of TCP
> stream, on top of IP frames, on top of electronic stream, on top of
> quantum of photons... It's turtle all the way, but there is only one
> turtle at each level)
>

I disagree completely.  WebSocket fragmentation isn't about supporting
streams but rather supporting senders that don't know the length up front
and advanced uses such as multiplexing.  The unit of communication via
WebSocket is always a message.

This question has to be answered in order to interpret a stream of frames
properly.  One of the following must be true to have a single unique
interpretation of a sequence of frames:

- control frames can't be fragmented
- control frames cannot be inserted in the middle of a fragmented message
- there must be a way to differentiate a control fragment from a data
fragment
- the receiver must keep an arbitrarily deep stack of in-progress messages

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