Re: [hybi] WS framing alternative

Jamie Lokier <jamie@shareable.org> Fri, 30 October 2009 13:10 UTC

Return-Path: <jamie@shareable.org>
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 4DAFD3A6896 for <hybi@core3.amsl.com>; Fri, 30 Oct 2009 06:10:47 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.432
X-Spam-Level:
X-Spam-Status: No, score=-2.432 tagged_above=-999 required=5 tests=[AWL=0.167, 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 byx8H0evWqi7 for <hybi@core3.amsl.com>; Fri, 30 Oct 2009 06:10:46 -0700 (PDT)
Received: from mail2.shareable.org (mail2.shareable.org [80.68.89.115]) by core3.amsl.com (Postfix) with ESMTP id 5FF3C3A67D3 for <hybi@ietf.org>; Fri, 30 Oct 2009 06:10:46 -0700 (PDT)
Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from <jamie@shareable.org>) id 1N3rFs-000197-BA; Fri, 30 Oct 2009 13:11:00 +0000
Date: Fri, 30 Oct 2009 13:11:00 +0000
From: Jamie Lokier <jamie@shareable.org>
To: Greg Wilkins <gregw@webtide.com>
Message-ID: <20091030131100.GD3579@shareable.org>
References: <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> <4AEA0E6C.1060607@webtide.com> <4AEA5713.8020008@it.aoyama.ac.jp> <Pine.LNX.4.62.0910300346010.25616@hixie.dreamhostps.com> <4AEA9DCE.7000703@webtide.com> <Pine.LNX.4.62.0910300919250.25608@hixie.dreamhostps.com> <4AEAD728.9060403@webtide.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <4AEAD728.9060403@webtide.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
Cc: hybi@ietf.org
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: Fri, 30 Oct 2009 13:10:47 -0000

Greg Wilkins wrote:
> > Could I ask you to more concretely describe your problem so that I could 
> > more concretely (maybe with actual code examples) describe the alternative 
> > solution that I am describing?
> 
> sticky load balancer with SSL offload that works with any ws app.

This is the key thing, I believe.

WebSockets forces all negotiation of extensions to be done by the
application.

This prevents automatic extensions being done below the application,
so "works with any WS app" is prevented by the current proposal.

Here's an example: Just like HTTP, there could be value in an
extension which compresses some frames.  If it worked well, that'd be
a good thing to do _transparently_ in the browser+server, without
awareness by the WS application.

But you can't provide a transparent compression extension, because the
browser has no way to signal to the server "I handle this extension".

In this respect, WS is like TCP where it's hard to modify
transparently.  This may be intentional: WS is meant to be a web
application compatible TCP after all.  But there is some value in
automatic extensions below the application, as we've seen in HTTP.

Given that the only thing blocking this is the client's inability to
signal the server that it supports an extension, and that is so easy
and natural to do by allowing clients to add headers to the initial
request, I think that should be at least seriously considered.  Not
dismissed summarily.

> multiplexing protocol implemented in browser/server (not in application).

That's similar to the compression example above.

> orderly closing a ws connection implemented in an application
> independent way.

Orderly close is more important than people realise.

A major problem with HTTP pipelining is you can't use it for
non-idempotent requests because the server may close the connection
any time, without implying an error condition.  That's one of the many
reasons HTTP pipelining often cannot be used, and that makes HTTP in
general slower and less network efficient than it could be.

The same applies to other request-response based protocols, such as
many of those expected to run over WebSocket.

Another problem with closing is that thing not mentioned in the HTTP
RFCs, but essential: lingering half-closed sockets.  If a server sends
a response followed by closing the socket fully, some clients sometimes
don't receive the whole response because of the way TCP and pipelined
requests clash.

Both of these are why orderly close is important - more important than
it appears.  Because it makes it safe to do other things.

I expect "pipelining" in the meaning used by HTTP, that is sending
multiple messages before getting a response to each one, to be quite
prevalant with protocols running over WebSocket.

That makes orderly close important for WebSocket, to avoid fragile
applications.  Hopefully I've illustrated the kinds of problems to
expect.  Unfortunately it's all a bit arcane.

There's nothing wrong with doing it in the application.  But I don't
have high expectation of it being done correctly in those "we don't
need no steenkin' framework" 100 line Perl scripts by inexperienced
authors.

-- Jamie