[Libwebsockets] Question re: packet buffering/packet loss
andy at warmcat.com
Tue Mar 10 14:15:18 CET 2015
On 10 March 2015 06:58:29 GMT+08:00, Jon <jon at mobilefs.com> wrote:
>I'm new to this list and to libwebsockets. I have just begun
>libwebsockets into my application which has a Windows server that
>potentially bursty stream of data to browser clients. I'm integrating
>libwebsockets code into my MFC based server dialog - so one key thing
>that I do not have a 'main' function loop. The data is all text based
>stock market data). I'm using pretty much the 'dumb_increment' callback
>routine to send packets to the clients (right now I'm testing with
That's probably your problem... dumb_increment is really dumb.
It's better to look at how the mirror protocol works, with a fifo and each individual connection keeps track of how much it is lagging and collects everything new it missed.
>For the most part, the data is getting from server to client. However,
>seeing inconsistent results on the client side which looks like there
>some packet loss. The clients are staggering when displaying the data -
>other words one client may randomly display the latest data while
>or may not. It does appear as though the clients are not getting all
>packets sent by the server. I'm not entirely where the source of this
>is but figured the most obvious would be to start with looking at how
>sending the data from the server.
>Two other things - I commented out the gettimeofday function and can
>put it back if inducing a slight delay is something I should do. Also,
>dropped the timer interval for the libwebsocket_service function down
>ms. I originally had the timer at the default 50ms and dropping it down
>actually seemed to help a bit although it is a bit hard to tell upon
>I read that by default libwebsockets will buffer data if it sees
>but I'm not sure if this is something I need to turn on or tweek with
>additional functions or parameters.
>Any help would be much appreciated. Thanks!
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
More information about the Libwebsockets