Re: [hybi] WS framing alternative

Greg Wilkins <gregw@webtide.com> Thu, 29 October 2009 21:51 UTC

Return-Path: <gregw@webtide.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 C410F3A6A21 for <hybi@core3.amsl.com>; Thu, 29 Oct 2009 14:51:37 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.349
X-Spam-Level:
X-Spam-Status: No, score=-2.349 tagged_above=-999 required=5 tests=[AWL=0.250, 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 S-oHUi9kJ63g for <hybi@core3.amsl.com>; Thu, 29 Oct 2009 14:51:36 -0700 (PDT)
Received: from mail-bw0-f223.google.com (mail-bw0-f223.google.com [209.85.218.223]) by core3.amsl.com (Postfix) with ESMTP id 8F6B53A6800 for <hybi@ietf.org>; Thu, 29 Oct 2009 14:51:36 -0700 (PDT)
Received: by bwz23 with SMTP id 23so2871572bwz.29 for <hybi@ietf.org>; Thu, 29 Oct 2009 14:51:50 -0700 (PDT)
Received: by 10.204.34.72 with SMTP id k8mr451437bkd.98.1256853109845; Thu, 29 Oct 2009 14:51:49 -0700 (PDT)
Received: from ?10.10.1.9? (60-242-119-126.tpgi.com.au [60.242.119.126]) by mx.google.com with ESMTPS id 15sm285645bwz.12.2009.10.29.14.51.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 29 Oct 2009 14:51:48 -0700 (PDT)
Message-ID: <4AEA0E6C.1060607@webtide.com>
Date: Fri, 30 Oct 2009 08:51:40 +1100
From: Greg Wilkins <gregw@webtide.com>
User-Agent: Thunderbird 2.0.0.23 (X11/20090817)
MIME-Version: 1.0
To: hybi@ietf.org
References: <8B0A9FCBB9832F43971E38010638454F0F1EA72C@SISPE7MB1.commscope.com> <Pine.LNX.4.62.0910270903080.9145@hixie.dreamhostps.com> <a9699fd20910270426u4aa508cepf557b362025ae5db@mail.gmail.com> <Pine.LNX.4.62.0910271824200.25616@hixie.dreamhostps.com> <4AE76137.8000603@webtide.com> <Pine.LNX.4.62.0910272118590.25608@hixie.dreamhostps.com> <20091029123121.GA24268@almeida.jinsky.com>
In-Reply-To: <20091029123121.GA24268@almeida.jinsky.com>
X-Enigmail-Version: 0.95.7
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit
Subject: Re: [hybi] WS framing alternative
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: Thu, 29 Oct 2009 21:51:37 -0000

Rory Byrne wrote:
> In a further effort to boost our chances of building robust
> WebSocket servers, I would hope that we might consider adding some
> sort of maximum frame length negotiation. Nothing fancy, there
> could be a suitable default maximum, and a 'Max-Frame-Length' header
> which enables a client to negotiate a higher maximum. Maybe something
> like this:
> 
>         GET /demo HTTP/1.1
>         Upgrade: WebSocket
>         Connection: Upgrade
>         Host: example.com
>         Origin: http://example.com
>         WebSocket-Protocol: sample
>         Max-Frame-Length: 2097152
> 
>         HTTP/1.1 101 Web Socket Protocol Handshake
>         Upgrade: WebSocket
>         Connection: Upgrade
>         WebSocket-Origin: http://example.com
>         WebSocket-Location: ws://example.com/demo
>         WebSocket-Protocol: sample
>         Max-Frame-Length: 1048576
> 
> The server would only send a 'Max-Frame-Length' header if it wanted to
> set the maximum to be lower than the client suggested. Any thoughts?


I think having the ability to negotiate such parameters is a good
way to fail fast if a server and client are not compatible (eg
client needs to send larger messages than server is willing to
receive).

But I'm sure that there will be resistance to having such negotiation
as a mandatory part of the protocol.

However, the problem with making this kind of negotiation optional
(and this goes for my earlier examples of a load balancer
communicating SSL info and/or node stickyness), is that the current
WS protocol has no place for meta data to be added in an optional
manner - so that it can be ignored by implementations that don't care.

Ian has previously said that instead of adding headers to the
Upgrade request/response, messages should be injected into the
stream to communicate this meta data.      However, because
there is no way to flag these messages as meta data, simple
implementations are going to try to handle them as messages.

This limitation of no standard meta-data paths, means that it
is nigh impossible to introduce features like multiplexing,
load balancing, fragmentations, HTTP transport etc. as optional
additional specifications built on top of ws.   Because there
is no meta channel, simple implementations will treat everything
as a message and break if there is any new protocol layered
on top.

This is SO simple to fix:

 1) WS should allow arbitrary headers in the upgrade request/response

 2) WS should define a frame type for transport meta data, whose
    content is defined only as Mime (or just mime headers).
    The semantics of these can be left to other protocols built
    on top of WS.

With these 2 simple additions, then we could later develop a
standards that (for example):

 + implement  multi-plexing by negotiated support  in the
   upgrade request/response and then injecting a meta data
   packet, before each data packet, containing the information
   needed to route the subsequent data message.

 + implement standards to send content advisory messages
   that would contain info such as language, content-type etc
   for a connection.   These could be used by implementations
   that wanted to be flexible, or ignored by implementations
   that are sure they know what they are connecting to.

The current proposal is just too nailed down.  There is no where
to insert any optional handling.   The API is wired to the TCP/IP
layer.  The handshake messages are locked down to binary equivalence.
There are spare framing types available - but any suggestions to
allocate that space for meta-data have been rejected.

It appears that the whatwg want layered protocols to be controlled by
the allocation of frame byte values to them and only officially
sanctified extensions will get the nod.   The Whatwg needs to loosen
up and realize  that it should not try to completely control how a
protocol will be used in the wild (eg an not force all servers
to be 100 line perl scripts).  They have to allow it some room to
breath and grow.    They need to allocate some space for some
arbitrary meta data to be used or ignored as implementations see fit.


regards