<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Ah, yes, I'm on the development version, I can recommend using it,
    it has some extra (badly needed as you discovered) functions, but I
    did not discover any drawback yet, I do consider it stable, I'm
    using it quite a lot: <br>
    <br>
    <pre class="wiki">git clone git://git.libwebsockets.org/libwebsockets

</pre>
    Good luck!<br>
    <div class="moz-cite-prefix"><br>
      On 06/20/2014 02:39 PM, Mike M wrote:<br>
    </div>
    <blockquote cite="mid:53A42B64.9090004@mordent.com" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      Unfortunately, that call doesn't seem to exist in the version I'm
      using.  What version is the latest stable version?<br>
      <br>
      Thanks!<br>
      -m<br>
      <br>
      <div class="moz-cite-prefix">On 06/20/2014 08:29 AM, Bas Appelo
        wrote:<br>
      </div>
      <blockquote cite="mid:53A4293C.9070507@appelo.nl" type="cite">
        <meta content="text/html; charset=ISO-8859-1"
          http-equiv="Content-Type">
        thread-1:<br>
            libwebsocket_service(context, LARGE_NUMBER); //blocks<br>
        <br>
        thread-2:<br>
            libwebsocket_cancel_service(context); // wakes up thread-1<br>
        <br>
        thread-1:<br>
            libwebsocket_callback_on_writable(context, wsi);<br>
            libwebsocket_service(context, LARGE_NUMBER); //blocks <=
        will call the callback!<br>
        <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>
        <br>
        <br>
        <div class="moz-cite-prefix">On 06/20/2014 02:18 PM, Mike M
          wrote:<br>
        </div>
        <blockquote cite="mid:53A4269F.7030108@mordent.com" type="cite">
          <meta http-equiv="content-type" content="text/html;
            charset=ISO-8859-1">
          <pre>>><i> Hi,
</i>>><i>
</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..!!
</i>>
>Libwebsockets is basically single-threaded.  But, with care from another 
>server thread, you can call either
>
>libwebsocket_callback_on_writable(), or
>libwebsocket_callback_on_writable_all_protocol()
>
>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.
>
>-Andy


</pre>
          <small>Hi,<br>
            <br>
            I am doing exactly this, but it doesn't work.<br>
            <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>
            <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>
            <br>
            Thanks,<br>
            -m<br>
            <br>
          </small> <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <br>
          <pre wrap="">_______________________________________________
Libwebsockets mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Libwebsockets@ml.libwebsockets.org">Libwebsockets@ml.libwebsockets.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://ml.libwebsockets.org/mailman/listinfo/libwebsockets">http://ml.libwebsockets.org/mailman/listinfo/libwebsockets</a>
</pre>
        </blockquote>
        <br>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
Libwebsockets mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Libwebsockets@ml.libwebsockets.org">Libwebsockets@ml.libwebsockets.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://ml.libwebsockets.org/mailman/listinfo/libwebsockets">http://ml.libwebsockets.org/mailman/listinfo/libwebsockets</a>
</pre>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
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>
</pre>
    </blockquote>
    <br>
  </body>
</html>