[Libwebsockets] Multiplexing with libwebsockets

Andy Green andy at warmcat.com
Mon Sep 16 15:21:04 CEST 2013


Daniel Griscom <griscom at suitable.com> wrote:
>My personal need is an embedded GUI. As I've 
>designed it, each visual subcomponent (built 
>using Dojo) connects back to an individual object 
>on the server (built using C++/libwebsockets). 
>This works well, and the design is nice and 
>clean, except for the proliferation of socket 
>connections; I'm up to six at a time, and will 
>probably add one or two more. I'm worried that 
>this may cause browser trouble down the line.

Yes I can see how that would come about.

>I'd definitely be interested in solving this in 
>the libwebsockets layer, especially if it 
>followed an eventual standard.

For serving side anyway it's definitely nice to have.

>So, questions:
>
>- Any thoughts on a reasonable limit to the 
>number of active (non-multiplexed) websocket 
>connections per web page?

The browser and the server might both have opinions about it.  8 doesn't sound insane.

>- Do you see Google's proposal becoming a standard?

Yes, it's the only hat in the ring and has been discussed for a long time on hybi.  Google have the same kind of problem as you in spades.

>- What kind of problems are yet to be resolved in your old code?

My code is incomplete and followed a much older draft.

Actually I'm not sure my code is good to follow except in terms of extension integration.  It seemed to get ferociously complicated much faster than I expected, usually a sign I missed the right way or failed to understand something somewhere along the line.

>- If I do move forward with this, would forking 
>libwebsockets on Github be an appropriate way to 
>contribute?

Sure that works fine for me.

-Andy

>Thanks,
>Dan
>
>
>At 8:33 PM +0800 9/16/13, Andy Green (ó-à¿úN) wrote:
>>On 16/09/13 20:09, the mail apparently from Daniel Griscom included:
>>>[Hi, Andy. Glad you're back in business.]
>>>
>>>Hello, all;
>>>
>>>I'd like to multiplex several connections over a single WebSocket. I
>>>know multiplexing isn't yet an official WebSocket extension, and
>>>Libwebsockets doesn't support it either, so I'll either have to build
>it
>>>myself or wait.
>>>
>>>Does anyone know about the status of multiplexing in the WebSocket
>>>standard? Any thoughts on implementing a solution inside
>Libwebsockets?
>>>(It looks like a significant amount of refactoring would be
>required.)
>>
>>Multiplexing was discussed by Google guys as an 
>>extension for a couple of years at least.
>>
>>I started implementing it (and it's still in the 
>>git history) but removed it when I realized I 
>>didn't really need it for what I was using 
>>libwebsockets for.
>>
>>There are many callbacks still included in 
>>libwebsockets that facilitate making an 
>>extension to do it.
>>
>>The reversion is here so you can see what there was all in one place.
>>
>>http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/commit/?id=4a673a38cadd452318609b81dc1270d8cdb6b6de
>>
>>I think there' a bit of a disconnect generally 
>>between "big iron" approaches and lightweight 
>>embedded library approach in terms of who would 
>>use or value multiplexing.  The people who were 
>>motivated to look at multiplexing didn't have a 
>>use-case that would leverage the implementation 
>>approach of libwebsockets.
>>
>>But if you're interested to implement we'd 
>>certainly take it as an extension.  The latest 
>>spec is here
>>
>>http://tools.ietf.org/html/draft-ietf-hybi-websocket-multiplexing-11
>>
>>-Andy
>
>
>--
>Daniel T. Griscom             griscom at suitable.com
>Suitable Systems              http://www.suitable.com/
>1 Centre Street, Suite 204    (781) 665-0053
>Wakefield, MA  01880-2400





More information about the Libwebsockets mailing list