[hybi] Proposed way forward for WebSockets

Ian Hickson <ian@hixie.ch> Tue, 27 July 2010 00:55 UTC

Return-Path: <ian@hixie.ch>
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 60DC83A6850 for <hybi@core3.amsl.com>; Mon, 26 Jul 2010 17:55:47 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.471
X-Spam-Level:
X-Spam-Status: No, score=-2.471 tagged_above=-999 required=5 tests=[AWL=0.128, 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 441WyxE7uyy0 for <hybi@core3.amsl.com>; Mon, 26 Jul 2010 17:55:46 -0700 (PDT)
Received: from looneymail-a1.g.dreamhost.com (caibbdcaaaaf.dreamhost.com [208.113.200.5]) by core3.amsl.com (Postfix) with ESMTP id 3682A3A67B5 for <hybi@ietf.org>; Mon, 26 Jul 2010 17:55:46 -0700 (PDT)
Received: from ps20323.dreamhostps.com (ps20323.dreamhost.com [69.163.222.251]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by looneymail-a1.g.dreamhost.com (Postfix) with ESMTP id CC15B15D57A for <hybi@ietf.org>; Mon, 26 Jul 2010 17:56:07 -0700 (PDT)
Date: Tue, 27 Jul 2010 00:56:07 +0000 (UTC)
From: Ian Hickson <ian@hixie.ch>
To: hybi@ietf.org
In-Reply-To: <4C4D66AF.9030905@opera.com>
Message-ID: <Pine.LNX.4.64.1007270030120.24444@ps20323.dreamhostps.com>
References: <ECF0E97F-1DA2-4662-BA48-F68B65AA8179@apple.com> <4C4D66AF.9030905@opera.com>
Content-Language: en-GB-hixie
Content-Style-Type: text/css
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Subject: [hybi] Proposed way forward for WebSockets
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: Tue, 27 Jul 2010 00:55:47 -0000

On Mon, 26 Jul 2010, James Graham wrote:
> 
> I think a different goal would be a better statement of Ian's intent:
> 
> "Websockets should be the minimal layer on top of TCP needed to meet the 
> additional requirements of browsers"

Yes, I think that's an accurate description of what I mean.


There are two parts to the protocol: the handshake, and the framing.

The handshake has basically three purposes: 1: allowing the protocol to be 
served by a server that also serves HTTP on the same port; 2: protecting 
existing servers and future WebSocket servers from cross-protocol attacks; 
3: allowing servers to host multiple domains and resources on the same 
IP/port combination, while supporting the browser origin security model.

The framing has one purpose: provide JavaScript applications running in 
Web browsers with a way to send and receive text messages to and from 
WebSocket servers.


There are a number of ways that we can make the protocol also support 
other goals:

 - Compression of frame data
 - Sending and receiving binary data
 - Allowing messages to be annotated with metadata*
 - Allowing multiple JavaScript applications from the same browser to 
   share a connection to a server (multiplexing)*

All of these could be supported by future backwards-compatible changes to 
the protocol, by having the client advertise support for each feature in 
the handshake, and having the server opt-in to using that feature. None of 
these changes require fundamental changes to the handshake.

Two of these, marked with an asterisk above, can also be implemented by 
script; therefore a good way of determining if they are truly needed is to 
deploy the protocol as is, and to see if people work around the lack of 
that feature by implementing it themselves. If they do, then the feature 
is needed and we should add it.

The other two features are clearly needed regardless, and we should add 
them in the near future. (Adding features piecemeal leads to more 
compliant client-side implementations, so we should not add them now.)


Here's a proposed timeline for adding these features:

 - We fix any critical bugs (not feature additions) in the protocol as it 
   stands today (next 4 weeks).

 - We deploy the protocol in four or more major browser vendors (next 4
   months).

 - When binary support in WebGL is stable, we add binary support to XHR, 
   WebSocket, etc (a matter of months?).

 - We look at how the protocol is used (another couple of months).

 - During this time, we build client and server test suites for the 
   protocol.

 - We add built-in support for the features that are needed based on 
   implementation experience (about 6 months from now), including 
   compression, multiplexing, per-frame metadata annotation, etc, as 
   needed.

 - We update the test suites.


I think it would be a mistake to add every feature we can think of right 
away, because doing so would mean that we added features before their need 
was proven, and it would lead to much less conforming client 
implementations. This dynamic has been proven time and time again with Web 
technologies; we should not repeat that mistake.

It would also be advantageous to allow implementors to experiment with 
ideas like multiplexing before we add the feature to the protocol, since 
it would let us use their implementation experience when designing the 
extensions to the protocol. Only by first getting the basic protocol out 
there and then experimenting with it can we really find how these ideas 
work out in real deployments.


(Thanks to Ian Fette for providing a sounding board for some of this.)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'