[Libwebsockets] multithreaded client and ring buffer question

Dave Horton daveh at beachdognet.com
Sat Jan 12 02:50:14 CET 2019

Hi - I’m a bit of a newbie, looking forward to using this library to build a high-performance multithreaded websocket client.  My program will need to establish multiple connections to many different far-end web servers, and send a large amount of near real-time data over those connections.

From reading the README docs and examples (thanks!) I think I have a basic idea of what I need to do (but interested in key things I am missing):
- While my program will have many threads that want to send, I will have one wsi service thread running my callback, and just call ‘lws_callback_on_writable’ from the other threads
- I will use ringbuffers to stash the data waiting to go out (e.g waiting to get a LWS_CALLBACK_CLIENT_WRITEABLE event).

My first question is whether there is any documentation on the ringbuffer API that I could study?  It looks like there are a bunch of useful functions, but if there is a good overview doc on them it would be helpful.

Any other pointers or guidance welcome..


More information about the Libwebsockets mailing list