Re: [hybi] Call for interest: multiplexing dedicated for WebSocket

Tobias Oberstein <> Tue, 04 June 2013 11:12 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id BBA6321F9B42 for <>; Tue, 4 Jun 2013 04:12:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[AWL=-0.500, BAYES_00=-2.599, J_CHICKENPOX_12=0.6, J_CHICKENPOX_44=0.6]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id Y+By8xlTNVjz for <>; Tue, 4 Jun 2013 04:12:23 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id 4E06021F9B7E for <>; Tue, 4 Jun 2013 03:04:34 -0700 (PDT)
Received: from ([]) by ([]) with mapi; Tue, 4 Jun 2013 03:04:33 -0700
From: Tobias Oberstein <>
To: Takeshi Yoshino <>
Date: Tue, 4 Jun 2013 03:04:31 -0700
Thread-Topic: [hybi] Call for interest: multiplexing dedicated for WebSocket
Thread-Index: Ac5hBlATZ073JABoSNOC4CQ+WWItZQAAWhlw
Message-ID: <>
References: <> <> <> <007501ce56f0$67f74080$37e5c180$> <> <> <> <> <> <> <> <>
In-Reply-To: <>
Accept-Language: de-DE, en-US
Content-Language: de-DE
acceptlanguage: de-DE, en-US
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Cc: Simone Bordet <>, "" <>
Subject: Re: [hybi] Call for interest: multiplexing dedicated for WebSocket
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Tue, 04 Jun 2013 11:12:39 -0000

>     Another issue: implementing <>. like priority based
>     scheduling at app level would might require to reinvent some kind of
>     fragmentation at the app level to be able to schedule according to
>     priority (otherwise once a very large message on a low prio channel
>     is started to be sent, it'll block everything else).
> Yes. The app must be able to send a fragment.
> But it's a matter of WebSocket API. A server can do that, but if a 
> client want to, it can't for now due to limitation of the API. Hence, it 
> needs application level fragmentation.

The WS client implementation could do auto-fragmentation. The fragment size
could be chosen by upstream bandwidth and latency target. A WS server could do
the same. Auto-fragment based on downstream bandwidth and latency target.

The app isn't bothered with fragmentation then.

>     Hence I'd like to propose to
>     1) add an (optional) extension parameter "scheduler" as above
>     2) use the 3 currently unassigned RSV bits in AddChannelRequest for
>     channel prio (when scheduler="priority")
>     3) define appropriate MUST semantics (scheduling should not follow
>     advisory semantics .. apps should be able to rely on it)
>     4) probably add a new PriorityControl message to change prio of
>     existing channels
>     ===
> WebSocket API is not ready for such a sophisticated ToS mechanism.


Apart from extending the JS WS browser API (which currently only has
WS URL and protocol for open) with ToS:

var sock = new WebSocket("ws:// ", [], {scheduler: "priority", priority: 7});

This would assume that logical WS channels eligible to be shared over 1 physical WS
not only share same host:port, but also scheduler.

[this API does not provide for 4) - dynamically changing channel prio]

Another option would be to let the server choose based on URL requested

URL 1 : ws://
URL 2 : ws://

If the client connects and speaks MUX, the server can answer (in opening handshake)

mux; scheduler=priority; priority=7

for URL 1 e.g.. For the first connection, that would happen on the physical WS. For subsequent
connections, it would happen on logical WS (scheduler needs to be the same): MUX is not nested,
but only the "priority" parameter used by the client WS implementation.

Yet another option would be to "use" URL parameters to hint

URL 1 : ws://
URL 2 : ws://

and let the server make final decision.

>     Example:
>     An app creates an empty file on some cloud service. Subsequently the
>     app wants to append to that file.
>     The first could be a high-prio message, the latter messages low-prio.
>     The app does not care whether those messages travel over 1 physical,
>     or multiple different logical WS channels.
>     However, the app does care that the first "create file" message
>     arrives before any subsequent "append to file" messages.
>     So a different design involving per-message prios on a single WS
>     channel (physical or logical) might allow higher-prio messages to
>     overtake lower prio-messages, but not otherwise round.
> I see.

This would definitely require API change

sock.send("foobar", 7); // send message with priority 7

It would provide even richer semantics to an app though ..