[Libwebsockets] Libwebsockets push from the server problem
"Andy Green (林安廸)"
andy at warmcat.com
Sat Feb 15 07:54:52 CET 2014
On 04/02/14 22:28, the mail apparently from Sergio Vasquez included:
> I have almost finished my own server with
> libwebsockets-1.23-chrome32-firefox24, but there is a last subprotocol
> that I will need to implement. That protocol needs that the client
> establishes the connection and then wait for the server to push data
> within a certain frequency. During that time the client must just wait,
> it cannot send any message to the server.
> My problem is that the threads where the server code is executing must
> return and my wsi (struct libwebsocket parameter) cannot be saved.
> I manage to save the context but I do not know how to push data just
> with that. Do you have any ideas?
If you trap the connection established and closed callbacks, you can
hold a wsi under some circumstances.
But about the only thing it's safe to do with it is call the "call me
back when writeable" callback
and you'll have to do your own thread locking in established / close and
around the call to libwebsocket_callback_on_writable().
However that's enough to do what you want, the connection will receive a
callback a short time later and can look in there to understand he needs
to send something.
> Sergio Vasquez
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
More information about the Libwebsockets