Re: [hybi] Subprotocol and Control Frames

Ian Fette (イアンフェッティ) <ifette@google.com> Wed, 05 October 2011 06:01 UTC

Return-Path: <ifette@google.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 DBB1621F849C for <hybi@ietfa.amsl.com>; Tue, 4 Oct 2011 23:01:54 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -105.676
X-Spam-Level:
X-Spam-Status: No, score=-105.676 tagged_above=-999 required=5 tests=[AWL=0.000, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OLZcjGzR+Mlx for <hybi@ietfa.amsl.com>; Tue, 4 Oct 2011 23:01:53 -0700 (PDT)
Received: from smtp-out.google.com (smtp-out.google.com [74.125.121.67]) by ietfa.amsl.com (Postfix) with ESMTP id 614E921F846D for <hybi@ietf.org>; Tue, 4 Oct 2011 23:01:53 -0700 (PDT)
Received: from hpaq14.eem.corp.google.com (hpaq14.eem.corp.google.com [172.25.149.14]) by smtp-out.google.com with ESMTP id p9564xCX019494 for <hybi@ietf.org>; Tue, 4 Oct 2011 23:04:59 -0700
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1317794700; bh=drHn+/4U05TgPYTeE8KIb3+g76g=; h=MIME-Version:Reply-To:In-Reply-To:References:Date:Message-ID: Subject:From:To:Cc:Content-Type; b=oZLzXoG3VZDva8VYKNAyooecDIY21Xb8akZ31JxZGi2lvV3KklIT6zwjjm+EOq+Zn FNmBWJNcLI9n22/0EVZiA==
DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=dkim-signature:mime-version:reply-to:in-reply-to:references:date: message-id:subject:from:to:cc:content-type:x-system-of-record; b=DgyD/9gbnODxtkQ75oCREcoPegB1O5fApz93LuoMs6XlHhm2bbEfKVOnTyG35AGAy bk+CAKapyF9ropAid3+uQ==
Received: from iadj38 (iadj38.prod.google.com [10.12.136.38]) by hpaq14.eem.corp.google.com with ESMTP id p9564X2i012786 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <hybi@ietf.org>; Tue, 4 Oct 2011 23:04:58 -0700
Received: by iadj38 with SMTP id j38so2481448iad.1 for <hybi@ietf.org>; Tue, 04 Oct 2011 23:04:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=7Y/Chb1QV76EFVN90krgXEfa+Cm7obwr438Z0SbVpA4=; b=S5m/Wacf98z3gmSpAPw67LaH7t+NoiOsrJ25xVi/aD7SNPimBIViGj5DSGzlx5OJA0 xIpOLsV4FzgAs/uLHBjQ==
Received: by 10.231.0.140 with SMTP id 12mr3603655ibb.98.1317794697996; Tue, 04 Oct 2011 23:04:57 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.231.0.140 with SMTP id 12mr3603644ibb.98.1317794697818; Tue, 04 Oct 2011 23:04:57 -0700 (PDT)
Received: by 10.231.35.10 with HTTP; Tue, 4 Oct 2011 23:04:57 -0700 (PDT)
In-Reply-To: <92457F4F764A5C4785FCDBDDDD76477A123C8F43@dfweml506-mbx>
References: <92457F4F764A5C4785FCDBDDDD76477A123C6E12@dfweml506-mbx> <CAH_y2NG+1TcQP6TVNbuwt6bjtCpQLaXtZvRjzBTefCrhb22+vA@mail.gmail.com> <92457F4F764A5C4785FCDBDDDD76477A123C6EA7@dfweml506-mbx> <CABLsOLCiBg3qD0TS9fYwpiw_WeXW3FYKjVcn-SA-biHTUdwgiA@mail.gmail.com> <92457F4F764A5C4785FCDBDDDD76477A123C7F00@dfweml506-mbx> <CABLsOLCfPW3HZF0q6=-sC0FGkJcqkdh4yj_4dvPH-ggbwUeM=A@mail.gmail.com> <92457F4F764A5C4785FCDBDDDD76477A123C8F43@dfweml506-mbx>
Date: Tue, 04 Oct 2011 23:04:57 -0700
Message-ID: <CAF4kx8dRf3dZDLhzg=uTDDa3d1QDoE=UcgZ=e_7amtPYcB_XPg@mail.gmail.com>
From: "Ian Fette (イアンフェッティ)" <ifette@google.com>
To: Hapner mark <hapner.mark@huawei.com>
Content-Type: multipart/alternative; boundary="0015177409c0d9b4e504ae86fcda"
X-System-Of-Record: true
Cc: "hybi@ietf.org" <hybi@ietf.org>, Greg Wilkins <gregw@intalio.com>
Subject: Re: [hybi] Subprotocol and Control Frames
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
Reply-To: ifette@google.com
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: Wed, 05 Oct 2011 06:01:55 -0000

On Tue, Oct 4, 2011 at 10:36 PM, Hapner mark <hapner.mark@huawei.com> wrote:

>  >From: John Tamplin [jat@google.com]
>  >Sent: Tuesday, October 04, 2011 9:18 PM
>  >To: Hapner mark
>  >Cc: Greg Wilkins; hybi@ietf.org
>  >Subject: Re: [hybi] Subprotocol and Control Frames
>  >
>  >On Wed, Oct 5, 2011 at 12:00 AM, Hapner mark <hapner.mark@huawei.com>
> wrote:
>  >Thanks for the further clarifications/corrections ...
>  >
>  >So if I understand correctly, extension opcodes are globally defined and
> extensions are required to be defined such that they can be combined in
> adhoc combinations.
>  >
>  >They are globally defined, but it is yet to be determined whether they
> can be allocated in overlapping fashion or dynamically.  We couldn't reach
> agreement on those, so we left it the way it is now, which basically means
> they can't be used without getting some agreement on them.  For example, one
> proposal was that each extension specify how many opcodes and reserved bits
> it needs, and those are allocated as needed per connection.  If we go with
> that approach, we could create a spec that defines the mechanism for
> dynamically allocating these resources, and then extension specs that want
> to make use of this could simply refer to that spec.
>  >
>  >Basically, the intent is to cross that bridge when we get there, and
> hopefully we will have real use cases to consider to guide that decision.
>  >
>  >I would disagree that most users of HTTP put a framing protocol in HTTP
> bodies. They put MIME types (i.e. content types) in bodies. Content types do
> not contain protocol control - only the HTTP header contains (should
> contain) protocol control.
>  >
>  >Most JSON or SOAP-based services I have used do in fact have some sort of
> message type in the payload, but YMMV.
>  >
>  >To be specific, providing one extension control frame opcode for
> overloaded use by a subprotocol, combined with allowing subprotocols to use
> extension data (or append 'subprotocol extension data' to the end of
> protocol extension data) would likely resolve this issue (MBWS would
> definitely use it). Also, the API would need to be extended to provide
> access to these subprotocol features so AJAX clients could access them.
>  >
>  >I really don't see the difference -- if MBWS were to say "I want 20 bytes
> of extension data", how is that any different than just using the first 20
> bytes of the WS payload as its extension data, and the remainder of the WS
> payload as the upper-level payload?
>
> My main issue is with putting MBWS control frames into WebSocket message
> payloads.
>
> Putting MBWS message metadata into its associated message payload is a
> lesser issue. It requires the definition of an extension data mechanism
> within text message payloads and binary message payloads that mirrors what
> already exists in WebSocket.
>
> You equate WebSocket with TCP. I equate it with HTTP. Possibly neither of
> us is fully correct.
>
> HTTP added a framing protocol over TCP so does WebSocket. If all extended
> use of WebSocket has to treat it like TCP, then Clebert and I should get on
> with implementing our MBWS message framing protocol and stop annoying the
> WG.
>
> On the other hand, there is great potential to reuse/extend the WebSocket
> protocol in much the same way that the web community has with HTTP. If the
> community had treated HTTP like it was TCP it would be worse off (as WS* did
> and is). Possibly the TCP analogy with WebSocket is not the most productive
> mental model of WebSocket's role in web architecture.
>
> What would be the harm in considering extending the functionality of
> WebSocket subprotocol in the way I'm suggesting? Wouldn't having one less
> layer be a useful result.


At the end of the day, the way I think of it is that extensions are for
protocol level things that the client and server software must support.
subprotocols are contracts between the application software running in the
client and server, but the client and server are blissfully unaware of any
of these semantics. It would be hell if you had to recompile Apache to
understand the semantics of each website you wanted to serve.

If you're changing the framing in a meaningful way (e.g. changing message
opcodes), then servers and intermediaries need to be altered and recompiled
to deal with those changes. At that point, you've defined an extension. If
you're not meaningfully changing the framing, but you're simply instructing
the other endpoint "Here's how to interpret the data contained in the
payload of the message", the servers and intermediaries don't need to be
recompiled and you are defining a subprotocol.

I suspect that what you are trying to do, like many things, could be written
as either an extension or a subprotocol. We could define an extension for
google search - send a search opcode and the search terms and get back a
results opcode with the search results. Yes, it's a bit of a facetious
example, but I'm merely trying to illustrate a point. The mere fact that
something can be done that way doesn't make it necessarily appropriate or
desirable. It's not clear to me as a browser vendor why I would want to
implement either a google search extension or an MBWS extension, for
example, nor why I would want to agree to opcodes and reserved bits being
allocated for its use.

-Ian