[Libwebsockets] Send messages to client from Server
andy at warmcat.com
Thu Sep 25 08:51:31 CEST 2014
On 25 September 2014 14:46:39 GMT+08:00, SriHarsha <mynameissriharsha at gmail.com> wrote:
>How are you ?
>I had a quick question about how to send messages from the server to
>Right now I am hoping when I receive a connection in my callback
>I can store the pointer to the libWebSocket struct and use it later on.
>When I want to send the message from the server to my client I want to
>and then pass the pointer that I had stored previous.
>Do you think this is a nice way to do it ?
No, the library does not work like that.
Look at the example apps and how they ask for a callback when the connection is writeable, and do any writing from that callback.
You can keep a wsi by following the lifecycle callbacks, but unless you have another thread that wants it (and he is only allowed to ask for a callback when it is writeable), you do not need to.
>Any help is greatly appreciated.
More information about the Libwebsockets