Re: [hybi] WebSocket subprotocol parameters

Tobias Oberstein <tobias.oberstein@tavendo.de> Tue, 21 January 2014 10:12 UTC

Return-Path: <tobias.oberstein@tavendo.de>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id EEF2B1A009E for <hybi@ietfa.amsl.com>; Tue, 21 Jan 2014 02:12:18 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.4
X-Spam-Level:
X-Spam-Status: No, score=-0.4 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, J_CHICKENPOX_34=0.6, J_CHICKENPOX_37=0.6, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AY-lPpV_OQu7 for <hybi@ietfa.amsl.com>; Tue, 21 Jan 2014 02:12:18 -0800 (PST)
Received: from EXHUB020-3.exch020.serverdata.net (exhub020-3.exch020.serverdata.net [206.225.164.30]) by ietfa.amsl.com (Postfix) with ESMTP id C9F991A009D for <hybi@ietf.org>; Tue, 21 Jan 2014 02:12:17 -0800 (PST)
Received: from EXVMBX020-12.exch020.serverdata.net ([169.254.3.11]) by EXHUB020-3.exch020.serverdata.net ([206.225.164.30]) with mapi; Tue, 21 Jan 2014 02:12:17 -0800
From: Tobias Oberstein <tobias.oberstein@tavendo.de>
To: "\"Martin J. Dürst\"" <duerst@it.aoyama.ac.jp>, Peter Thorson <webmaster@zaphoyd.com>
Date: Tue, 21 Jan 2014 02:12:14 -0800
Thread-Topic: [hybi] WebSocket subprotocol parameters
Thread-Index: Ac8WiadLG+rI7ZtES6iZWjxzi55plQAAS0rw
Message-ID: <634914A010D0B943A035D226786325D4446C082A0D@EXVMBX020-12.exch020.serverdata.net>
References: <634914A010D0B943A035D226786325D4446BF9948F@EXVMBX020-12.exch020.serverdata.net> <52D90F99.6080205@gmx.de> <634914A010D0B943A035D226786325D4446BF9949D@EXVMBX020-12.exch020.serverdata.net> <CAH9hSJZQ3NxVW36PnZ0TpMF4tPPaJLr12M8NtbPb6pUejf1wcQ@mail.gmail.com> <634914A010D0B943A035D226786325D4446BF99977@EXVMBX020-12.exch020.serverdata.net> <B8ED6F18-B710-44AE-829B-EDE5859B2C5B@zaphoyd.com> <52DE3B1B.1010804@it.aoyama.ac.jp>
In-Reply-To: <52DE3B1B.1010804@it.aoyama.ac.jp>
Accept-Language: de-DE, en-US
Content-Language: de-DE
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
acceptlanguage: de-DE, en-US
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Cc: Julian Reschke <julian.reschke@gmx.de>, "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] WebSocket subprotocol parameters
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.15
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: Tue, 21 Jan 2014 10:12:19 -0000

> > My impression was that subprotocol primarily changed the interpretation
> of messages payloads by the end applications themselves. WebSocket
> messages allow essentially arbitrary data so you can define whatever
> parameter setting mechanism you like with whatever grammar makes sense
> for your subprotocol and send the parameters in the opening “hello”
> message. Defining a grammar in the socket spec to allow application
> protocols to configure themselves seems limiting and out of scope.
> 
> Yes indeed. It has always been my impression that even subprotocols
> themselves are rather unnecessary. On the server side, just use a different
> URI/IRI as endpoint. On the client side, it's all JS anyway.

No quite, since using a different URL does not allow the server to communicate back
it's subprotocol selection, e.g.

Sec-WebSocket-Protocol: foo.msgpack, foo.json

allows the client to announce the "foo" protocol in 2 variants (MsgPack and JSON serialization)
and the server to _select_ one of those, and communicate back it's selection to the client.

An URL

ws://server.com?serializers=msgpack;json

does not allow the server to communicate back it's selection.

Further, as an example, imagine a subprotocol that allows message batching with length prefixes, that wants to negotiate the number of bytes used for the length prefix.

Sec-WebSocket-Protocol: foo; max_len_prefix=4

A server that wants to use "len_prefix=3" cannot communicate that - neither with URL (since there is no "URL response"), and not with Sec-WebSocket-Protocol,
since the server _must_ choose one subprotocol announced by the client _exactly_.

It cannot answer

Sec-WebSocket-Protocol: foo; len_prefix=3

Since the number of bytes per length prefix in batched messages is needed to _parse_ already the first WebSocket message at application level,
negotiating at the WS application message level does not work either (or gets complicated).

So I still think having Sec-WebSocket-Protocol work like Sec-WebSocket-Extension would have been useful.

/Tobias