Re: [hybi] Multiplexing in WebSocket

Greg Wilkins <gregw@webtide.com> Sun, 25 October 2009 08: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 5EBE13A67D6 for <hybi@core3.amsl.com>; Sun, 25 Oct 2009 01:51:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.468
X-Spam-Level:
X-Spam-Status: No, score=-1.468 tagged_above=-999 required=5 tests=[AWL=0.816, BAYES_00=-2.599, SARE_MILLIONSOF=0.315]
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 mKLsoinloXpt for <hybi@core3.amsl.com>; Sun, 25 Oct 2009 01:51:33 -0700 (PDT)
Received: from mail-px0-f183.google.com (mail-px0-f183.google.com [209.85.216.183]) by core3.amsl.com (Postfix) with ESMTP id 77B653A67AF for <hybi@ietf.org>; Sun, 25 Oct 2009 01:51:33 -0700 (PDT)
Received: by pxi13 with SMTP id 13so7642501pxi.32 for <hybi@ietf.org>; Sun, 25 Oct 2009 01:51:43 -0700 (PDT)
Received: by 10.115.25.9 with SMTP id c9mr17988837waj.229.1256460703645; Sun, 25 Oct 2009 01:51:43 -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 22sm118458pxi.10.2009.10.25.01.51.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 25 Oct 2009 01:51:42 -0700 (PDT)
Message-ID: <4AE4119A.7040803@webtide.com>
Date: Sun, 25 Oct 2009 01:51:38 -0700
From: Greg Wilkins <gregw@webtide.com>
User-Agent: Thunderbird 2.0.0.23 (X11/20090817)
MIME-Version: 1.0
To: Ian Hickson <ian@hixie.ch>
References: <4ACE50A2.5070404@ericsson.com> <3a880e2c0910081600v3607665dp193f6df499706810@mail.gmail.com> <4ACF4055.6080302@ericsson.com> <Pine.LNX.4.62.0910092116010.21884@hixie.dreamhostps.com> <4AD2E353.8070609@webtide.com> <4AD2F43D.6030202@ninebynine.org> <4AD39A64.4080405@webtide.com> <Pine.LNX.4.62.0910132335390.25383@hixie.dreamhostps.com> <4AD53DCA.6050304@webtide.com> <Pine.LNX.4.62.0910170203460.9145@hixie.dreamhostps.com> <4ADA7FD4.9010406@webtide.com> <4ADB6F0B.4000004@gmail.com> <Pine.LNX.4.62.0910221120380.9145@hixie.dreamhostps.com> <4AE08907.7080402@webtide.com> <Pine.LNX.4.62.0910230348470.9145@hixie.dreamhostps.com> <4AE1E659.5050507@webtide.com> <Pine.LNX.4.62.0910232154470.13521@hixie.dreamhostps.com> <4AE23D7A.2060009@webtide.com> <Pine.LNX.4.62.0910240926500.9145@hixie.dreamhostps.com>
In-Reply-To: <Pine.LNX.4.62.0910240926500.9145@hixie.dreamhostps.com>
X-Enigmail-Version: 0.95.7
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit
Cc: hybi@ietf.org
Subject: Re: [hybi] Multiplexing in WebSocket
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: Sun, 25 Oct 2009 08:51:34 -0000

Ian Hickson wrote:

>> I've made this programming error myself many times! So perhaps I too am 
>> one of the authors that should not be writing network protocols.
> 
> If you don't think you should be writing one, you almost certainly 
> shouldn't be designing one. :-)

touche!   :)


> The main difference is that most people won't manage UTF-8 encoding. In 
> Perl, for instance, there's the "Encode" library that you can just pass 
> byte strings to to have them converted into UTF-8, and vice-versa.

Forgive my total lack of knowledge of perl, but given the availability
of the encode library in perl, I see little difference in the complexity
of sentinel marked code which is:

  $octets = encode("utf-8", $message)
  write ($octets)
  write (oxff)

versus length encoding code which is

  $octets = encode("utf-8", $message)
  write ($octets.length)
  write ($octets)


They will need a method to correctly encode the length
as an unlimited integer, but they will probably need that
anyway as  you currently specify that length encoded
framing is part of the standard (stacked out).


> We have binary frames already staked out in the protocol, waiting for 
> support in JS for binary.

I don't see why an IETF protocol proposal needs to wait for
the js implementation?

Since the binary framing is about the same level of
complexity, is more capable and is already stacked
out - they why not avoid the complexity to two
different framings and just use length?

JS is free to limit it's usage to just utf-8 as long
as it likes.   But JS is not the only client language
that is going to use an IETF sanctioned bidirectional
protocol.


>> * A mobile phone that is restricted to a single outgoing
>>   connection (not uncommon) so the browser wants to
>>   transport HTTP over the websocket connection
> 
> Could you elaborate on this use case?

I unfortunately don't have all the details, but I have
been a little involved in the development of a comet
system for a large mobile phone company for global
deployment.

One of the issues that we had to deal with was a single
connection limit that apparently affects many millions
of phones.  This was a restriction for a non
browser application running on the phone with direct
access to the TCP/IP layer.

However I'm unclear if the limit was imposed by firmware
in the phone or carriers.


>> * Something that none of us has thought of yet
> 
> Once we think of it, we can address it. There's no point trying to 
> optimise for something we don't know about; we have no way to know if we 
> are optimising in the right way.


I fundamentally disagree - and I think that this difference is
probably at the root of most/all our other differences on the
protocol.


I think the wait and see position you advocate is entirely
correct for the websocket API.

But i think it is entirely wrong for the websocket protocol.

A flexible and extensible protocol can be restricted to known
uses by the API.  You then do not need to update the entire
network infrastructure for each and every new idea.   Your
attempt to "stack out" the binary protocol is justified
by avoiding exactly this type of breakage.



> To send a stream of images with WebSocket, you will need to wait until 
> JavaScript gives you a way to get the image data in a usable form. I 
> certainly wouldn't recommend sending it as text, that would be stupid.

I think this is another fundamental disagreement.

I think the IETF should be considering a bidirectional solution for all
web clients - not just for HTML5 JS clients

Again, from my mobile experience, I have seen comet protocols
stream a users thumbnail image with a chat message, because of the
latencies involved with a separate fetch.   For the corresponding
web browser solution, the comet stream just sends a URL of the
thumbnail.


So I think it is really important for the IETF BOF/WG to resolve
these fundamental differences.   If you are designing a non-extensible
protocol that only supports HTML5 websocket API, then you may well
end up with something like the websocket protocol.   But if you
want something that is extensible and supports bidirectionality
for any web client, then I think then it will look substantially
different.


regards