[Libwebsockets] Server stops reacting after some time

Andy Green andy at warmcat.com
Tue May 10 08:17:35 CEST 2016

On 05/10/2016 02:06 PM, Ofer Chesler wrote:
> Hello,
> I’m writing a websocket server which interacts with the browser.
> In the browser I garb audio (Web Audio API), sends it to the server,
> which is doing some manipulations, and sends it back to the browser.
> In the browser I work with 512 samples each time and 2 channels, which
> means I send each time around 512 (samples) * 4 (each one is float) * 2
> (channels) = 4096 bytes
> Assuming the audio have 44.1Khz sample rate, I need to send (and
> receive) around  70 times a second.

I see.

> I wrote my server based on the test-server echo sample , and it starts
> working, until at a certain point is suddenly stops. (the browser tries
> to send more data but the server refuses to accept it).
> Any idea what might be the issue, or how can I debug it?

Well... there is almost no information to be able to guess the problem.

1) What version of lws is this?  What platform?

2) I'd get the developer Javascript console up on the browser side and 
see what it thinks has happened.

3) On the server side, the first question would be 'has it crashed'?  If 
it has crashed, maybe not with an abort, it can be interesting to run it 
under valgrind or gdb.

4) Enable cmake DEBUG mode cmake .. -DCMAKE_BUILD_TYPE=DEBUG and 
increase the logging using -d79 or so.

5) Find out what the server feels has happened... it feels the client 
connection closed?  Who closed it?  It's not closed?  The server doesn't 
see any more RX?  Or he can't do any more TX?

6) If permessage-deflate extension is negotiated, see if it's related to 
that by disabling it (info.extensions = NULL).

7) Likewise disable SSL if enabled

8) With no SSL or permessage-deflate, you can look for a clue by 
watching the network traffic directly with tcpdump (although browser ws 
payloads will be XORd, the header ws isn't) at the point it choked


> Ofer
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets

More information about the Libwebsockets mailing list