<meta content="text/html; charset=ISO-8859-1"
<body bgcolor="#FFFFFF" text="#000000">
libwebsocket_service(context, LARGE_NUMBER); //blocks<br>
libwebsocket_cancel_service(context); // wakes up thread-1<br>
libwebsocket_service(context, LARGE_NUMBER); //blocks <= will
call the callback!<br>
Now you will receive a callback, it works like a charm.<br>
So to write data you'll need to be in a callback, but the way above
shows you how to get there/enforce one.<br>
<div class="moz-cite-prefix">On 06/20/2014 02:18 PM, Mike M wrote:<br>
<blockquote cite="mid:53A4269F.firstname.lastname@example.org" type="cite">
<meta http-equiv="content-type" content="text/html;
</i>>><i> 1)Is there a way to asynchronously send the data to the client? That is,
</i>>><i> without being in a callback, server spontaneously initiating data
</i>>><i> transfer to the client..!!
>Libwebsockets is basically single-threaded. But, with care from another
>server thread, you can call either
>but you need to manage your own list of live wsi / connections with the
>first option (by tracking their creating and destruction in the
>ESTABLISHED and CLOSED callbacks).
>You will get a LWS_CALLBACK_SERVER_WRITABLE as soon as it's possible to
>write on that connection then, and you should figure out what to write
>and write it from there.
I am doing exactly this, but it doesn't work.<br>
I have a thread that calls libwebsocket_service with a huge
timeout. Writes, etc, are only ever done from within the
callback. When I need to write something from another thread, I
queue up the message that needs to be written and then
immediately call libwebsocket_callback_on_writeable_all_protocol
on the proto I'm writing for.<br>
Unfortunately, I never get LWS_CALLBACK_SERVER_WRITEABLE until
the libwebsocket_service times out and gets called again. This
is totally broken. I saw a trac issue (#56) about using ppoll.
Unfortunately, the version of the library we're using doesn't
seem to have that code in it. Any ideas?<br>
Libwebsockets mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libwebsockets@ml.libwebsockets.org">Libwebsockets@ml.libwebsockets.org</a>
<a class="moz-txt-link-freetext" href="http://ml.libwebsockets.org/mailman/listinfo/libwebsockets">http://ml.libwebsockets.org/mailman/listinfo/libwebsockets</a>