[Libwebsockets] How to communicate in real time and send heavy data on the same websocket channel

Andy Green andy at warmcat.com
Thu Sep 25 08:32:55 CEST 2014



On 25 September 2014 14:04:45 GMT+08:00, Thomas Spitz <thomas.spitz at hestia-france.com> wrote:
>Hello everyone,
>
>I'm using libwebsocket for real time data communication between a
>client
>and a server, this works very nicely. I will also need to send heavy
>data
>to this same client using websocket (without disturbing real time data
>transfer) and I would like to know what is the best solution (ideally
>using
>the same IP port)? Should I use a now protocol inside libwebsocket or
>is
>there a multiplexing mechanism somewhere?

You should think about what you actually want there.

I think all you want is low latency for your realtime data.

For that either open 2 x websocket connections using different protocols (they will be 'muxed' at tcp/ip level), or extend your protocol to also carry the payload, but using relatively small frames for the bulk data so the lower latency frames can get a chance.

Frankly, it's way simpler to open 2 x websocket connections.  Your big data can just follow websocket message semantics then.

>I have read that there were an attempt for multiplexing some time ago :
>http://ml.libwebsockets.org/pipermail/libwebsockets/2013-September/000540.html)
>and I also saw that some other librairies try to implement such a
>mechanism:
>https://www.rabbitmq.com/blog/2012/02/23/how-to-compose-apps-using-websockets/
>I would be really pleased to hear your suggestions.

Mux was pushed by google during the websockets standardization process.

However, it was implemented instead inside SPDY / HTTP2.0.  So neither google nor anyone else cares about mux over websocket any more, and I removed my code for it which had become cruft.

-Andy

>Best regards,
>Thomas
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list