[Libwebsockets] Fwd: How can i send array strings to browser on all websockets

Andy Green andy at warmcat.com
Tue Dec 31 15:09:40 CET 2013



satya gowtham kudupudi <satyagowtham.k at gmail.com> wrote:
>Why do you guys choose this poll-callback architecture? What is the

Because it is really very efficient, in cpu and memory terms, and scales really well.

>advantage? Its very confusing and its

Your being confused is not quite the same as it being confusing.  Many people are using it just fine.

 been included in ubuntu main line
>repository. How can I implement a multi channel broadcast server (i.e.
>array of  live data corresponding to a particular channel should be
>pushed
>to the channel corresponding websockets) using this library. A
>websocket is
>mapped to a particular channel based on channel name it receives in the
>initial frame from the browser.

You should study the test server mirror protocol.  Copy the test-server.c and discard the unrelated things like dumb-increment.

If the 'channel' is itself coming from the network but is not a websocket link, look at the external poll loop stuff in the test server.  If it's a seekable file that'll be simpler.

I can tell you already though if this "channel" is itself streaming, like audio, what you're describing is a network programming issue more than anything else.   Not every connection will be able to keep up every time, so you have to deal with stalled or too-slow connections.

The 'call back when writable' nonblocking approach is perfect for this kind of situation.

-Andy

>Thank you
>
>--
>Gowtham
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list