[Libwebsockets] Priority in LWS RingBuffer API
andy at warmcat.com
Tue Feb 4 17:55:08 CET 2020
On 2/4/20 4:34 PM, Peiffer Eric wrote:
> I use ring buffer api in order to bufferise message that I send to web
> socket client
> In my application some messages have higher priority than other. Is it a
> way where a can put message at the top of the ring so that they are
> written first?
As it is, no. You can add an api for it (and I'd be happy to see the
If you need something different than lws_ring you might find lws_dll2
useful for that
it's a general doubly-linked list abstraction... as such it's normal you
can add stuff either at the head or the tail.
It also has some interesting features like sorted insertion
you define the sorting function and it will use that to figure out where
to place the new guy in the linked-list.
lws_ring is built to handle n clients "subscribing" to the same ring
with independent tail pointers and only retire the tail when all the
clients have used it... if that's what you want it's probably easier to
add a way to insert at the tail to that than add that on top of
lws_dll2... depends on what you're doing with it.
More information about the Libwebsockets