Re: [hybi] Max frame size

Brodie Thiesfield <brodie@jellycan.com> Thu, 23 June 2011 11:26 UTC

Return-Path: <brofield@gmail.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B31BE11E8137 for <hybi@ietfa.amsl.com>; Thu, 23 Jun 2011 04:26:19 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.677
X-Spam-Level:
X-Spam-Status: No, score=-2.677 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VSIMlbAbeQDU for <hybi@ietfa.amsl.com>; Thu, 23 Jun 2011 04:26:19 -0700 (PDT)
Received: from mail-pv0-f172.google.com (mail-pv0-f172.google.com [74.125.83.172]) by ietfa.amsl.com (Postfix) with ESMTP id 23C3F11E807F for <hybi@ietf.org>; Thu, 23 Jun 2011 04:26:19 -0700 (PDT)
Received: by pvh18 with SMTP id 18so1161703pvh.31 for <hybi@ietf.org>; Thu, 23 Jun 2011 04:26:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=sECdP+mcSw5J/Tb+8b5ikVdtD0RN6KC4Q7wmJ57HjiA=; b=f2ZzCdTSaQ5vTcc6cPpeDV3SwFumWXX2KQVtREFCsog57KThzcMQsNfGizIqDO7zG0 FHEmHCRnQyeMp6W+o2B+HBqD+jZV5poeiZmztF/ZrC/87x2yJ4lGdS1f2/8QONJ6BAh2 B2hya30Fbk/ENt8QXEBNNNsKagLmIx6Sf9FFs=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=jSylmujwVpQzQ0W1HiEC5vG+5eF9ONPFTavY55+k1b928DTdpu014Yk5XSgwzxizB0 L9CNmN/VoKEA/SAk+vfepFzSfnWCIjzWRY4XLMD6qUv9AiuwcE1SZEPFDMEIHdVq+e7r dkAQwbw2jnehbuegf1PR81D0ffP2XPHLFDu20=
MIME-Version: 1.0
Received: by 10.68.48.7 with SMTP id h7mr982116pbn.152.1308828378654; Thu, 23 Jun 2011 04:26:18 -0700 (PDT)
Sender: brofield@gmail.com
Received: by 10.68.51.231 with HTTP; Thu, 23 Jun 2011 04:26:18 -0700 (PDT)
In-Reply-To: <1308826861.11268.47.camel@tot.local>
References: <1308720860.5393.18.camel@tot.local> <20110622060514.GF18843@1wt.eu> <1308738811.11941.704.camel@vulcan.aspl.local> <20110622122521.GA22198@1wt.eu> <1308756913.11941.823.camel@vulcan.aspl.local> <4E021121.5050409@caucho.com> <1308826861.11268.47.camel@tot.local>
Date: Thu, 23 Jun 2011 20:26:18 +0900
X-Google-Sender-Auth: yODbhuHvrpgUkzeR8H36iPA8JSs
Message-ID: <BANLkTinnSkPx7zkBDMUk_hVyK4TrbN9=4g@mail.gmail.com>
From: Brodie Thiesfield <brodie@jellycan.com>
To: =?ISO-8859-1?Q?Francis_Brosnan_Bl=E1zquez?= <francis@aspl.es>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: hybi@ietf.org
Subject: Re: [hybi] Max frame size
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/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, 23 Jun 2011 11:26:19 -0000

On Thu, Jun 23, 2011 at 8:01 PM, Francis Brosnan Blázquez
<francis@aspl.es> wrote:
> Hi Scott,
>> No. It's like a HTTP chunked POST, where the application receives a
>> stream of data, not the underlying HTTP chunks.
>>
>> A server (or client) which exposes the frames as its primary API is
>> doing it wrong.
>
> I think you are getting my wrong maybe because I mentioned "...which is
> called every single frame is received", but obviously my point is
[snip]
> ..and you really think this API is suitable for a message oriented
> protocol? (I assuming your fread concept will return bytes as it comes
> not complete messages)

Scott understood you and was only talking about the data, however the
file stream API metaphor might be distracting.

Websocket is a message based protocol, but the message contents are
byte streams that might be split into any number of frames. So your
websocket layer notifies your upper layer only of the messages and
bytes. The frames are a websocket layer concept that the next layer
has no need to know of.

The websocket layer will tell the upper layer about the start of a
message, then feed it bytes until the message is complete, then tell
it that the message is complete. The bytes may come from a single
frame, or multiple frames. The upper layer has no need to know.

Think of the processing as something like the following (note that
control frames, compression, etc is ignored):

while have connection:
    receive frame header
    if first frame in message:
        notify application layer of the start of a message
    receive bytes up to max of frame length:
        pass bytes up to the application layer as message data
    if last frame in message:
        notify application layer that the message is complete

The frames are never notified to the application layer. It doesn't need to know.

Brodie