[Libwebsockets] Complex issue with combinations of client/server push and pull

jon at keyonsec.com jon at keyonsec.com
Wed May 16 19:51:31 CEST 2018

Hello Andy/all,


Complex issue so I'm going to try to make this as clear as I can, please
forgive me if I need to clarify. I currently perform both push (server to
client) and pull (client requests from server) actions in my app. 


On the pulls, I use the RECEIVE and WRITABLE callbacks along with
lws_callback_on_writable and  'pss->' and everything works well.  On the
pushes I use the lws_callback_on_writable_all_protocol and the lws_service
functions and because with the pushes I haven't been interested in taking
advantage of the 'pss->' variable everything has been fine.


However, I have a new function that sends something potentially different
out to each client when I do a single push, and I want 'pss->' to tell me
what to push. As my initial call in sequence for this function is a pull, I
am able to save each client's state in 'pss->' off the init which is good.
However, for each ensuing push I'm competing with other pushes from other
functions and today I only have a generic 'lws_write' call that handles all
pushes. So my problem is that if I'm not differentiating between the types
of pushes that I'm doing that I cannot use the 'pss->' variable when I need


If I use a global variable, I'm concerned it's going to get messed up on
timing issues with the other pushes/pulls. I'm sure there's a better way but
just don't know it. Pls advise. Thanks.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20180516/78ea4c86/attachment.html>

More information about the Libwebsockets mailing list