[Libwebsockets] client threading question

Dave Horton daveh at beachdognet.com
Thu May 23 16:27:44 CEST 2019

I have an lws ws_client application that connects to multiple web socket servers and streams lots of data to them.  The client process itself is multithreaded, but I have one thread running the lws_service() call and one lws_context*.
At some point (~500 connections on my current hardware) the lws_service thread consumes all of one CPU and the program starts to falter, although I have idle CPU on other cores.

Is there any reason that I could not start multiple  threads (I’m thinking ~2-4) to run lws_service(), each with a corresponding lws_context* ?  


More information about the Libwebsockets mailing list