<html><head>
  <meta http-equiv="Content-Type" content="text/html; CHARSET=UTF-8">
  <meta name="GENERATOR" content="GtkHTML/4.2.2">
</head>
<body><div>Hello Francis,</div><div>good news! Thank you for the library :) Great </div><div><br></div><div>On Mon, 2017-02-13 at 20:18 +0100, Francis Brosnan Blázquez wrote:</div><blockquote type="cite">
Sorry Elmar, I missed an important piece..thanks for reporting! :-)<br>
Best Regards,<br>
<br>
<blockquote type="CITE">
    Hello Elmar,<br>
    <br>
    Certainly you have found a bug. I've updated noPoll's source code to<br>
    allow defining on_ready handlers at client side...which will be called<br>
    once handshake is completed.<br>
    <br>
    <a href="https://github.com/ASPLes/nopoll/commit/f1d3f5151c176f0f6af80cf671cbf611c2605d4c">https://github.com/ASPLes/nopoll/commit/f1d3f5151c176f0f6af80cf671cbf611c2605d4c</a><br>
    <br>
    We should be close to release next stable release (I hope this week),<br>
    Best Regards,<br>
    <br>
    <blockquote type="CITE">
<pre>Hello Francis,

according to your answer I have still one question. The debug output shows that the connection handshake was done without error. 
In this case the equivalent listener function fired on_ready. The client function doesn't.

nopoll_conn.c:
nopoll_conn_complete_handshake_check_listener()
nopoll_conn_complete_handshake_check_client()

Is this behavior desired? Or should the client function also fired on_ready?

debug output:
(proc 22914): (debug)nopoll_conn.c:2655 Sec-Websocket-Accept matches expected value..nopoll_conn_complete_handshake_check_client (0x1d71420, 0x1d72380)=1

Thank you so much
Elmar

</pre>
        On Sun, 2017-02-12 at 13:47 +0100, Francis Brosnan Blázquez wrote:<br>
        <blockquote type="CITE">
            <br>
            <blockquote type="CITE">
<pre>Hello everyone,
</pre>
            </blockquote>
            <br>
            Hello Elmar,<br>
            <br>
            <blockquote type="CITE">
<pre>I have just started to use nopoll as client application. I run the
basic WebSocket client example successfully. 
I tried to use nopoll_conn_set_on_ready() instead of
nopoll_conn_wait_until_connection_ready(). But my on_ready call back
never appears. Did I misunderstand something? Here is my code:

#include <stdio.h>
#include <nopoll.h>

nopoll_bool on_ready(noPollCtx *ctx, noPollConn *conn, noPollPtr
user_data){
  // send a message
  printf("I'm ready!\n");
  return nopoll_true;
}

int
main (int   argc,
      char *argv[])
{
  noPollCtx * ctx = nopoll_ctx_new ();
  if (! ctx) {
      // error some handling code here
  }

  nopoll_log_enable(ctx, nopoll_true);

  // call to create a connection
  noPollConn * conn = nopoll_conn_new (ctx, "localhost", "8080", NULL,
NULL, NULL, NULL);
  if (! nopoll_conn_is_ok (conn)) {
      // some error handling here
  }

  // set ready handle
  nopoll_conn_set_on_ready         (conn, on_ready, NULL);
</pre>
            </blockquote>
            <br>
            Ok, on_ready function is not fired until it is not fully established the connection.<br>
            You'll have to send something or force negotiation with something like<br>
            this:<br>
            <br>
                     // block during 5 seconds until connection is ready or timeout is reached<br>
            nopoll_conn_wait_until_connection_ready (conn, 5);<br>
            <br>
            See relevant information at nopoll_conn_new explaining more details about<br>
            your question:<br>
            <br>
            <a href="http://www.aspl.es/nopoll/html/group__nopoll__conn_ga0b31b7e0694d654663b49ecaf82c0776.html#ga0b31b7e0694d654663b49ecaf82c0776">http://www.aspl.es/nopoll/html/group__nopoll__conn_ga0b31b7e0694d654663b49ecaf82c0776.html#ga0b31b7e0694d654663b49ecaf82c0776</a><br>
            <br>
            Also, checkout the following links for fully working and complete examples:<br>
            <br>
            <a href="https://github.com/ASPLes/nopoll/blob/master/test/nopoll-regression-client.c">https://github.com/ASPLes/nopoll/blob/master/test/nopoll-regression-client.c</a><br>
            <a href="https://github.com/ASPLes/nopoll/blob/master/test/nopoll-regression-listener.c">https://github.com/ASPLes/nopoll/blob/master/test/nopoll-regression-listener.c</a><br>
            <br>
            Best Regards,<br>
            <br>
            <br>
            <blockquote type="CITE">
<pre>  // now call to wait for the loop to notify events
  nopoll_loop_wait (ctx, 0);
  }

Thanks  
Elmar
_______________________________________________
noPoll mailing list
<a href="mailto:noPoll@lists.aspl.es">noPoll@lists.aspl.es</a>
<a href="http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll">http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll</a>
</pre>
            </blockquote>
            <br>
            <table cellspacing="0" cellpadding="0" width="100%">
<tbody><tr>
<td>
<br>
<br>
</td>
</tr>
</tbody></table>
        </blockquote>
    </blockquote>
    <br>
    <table cellspacing="0" cellpadding="0" width="100%">
<tbody><tr>
<td>
<pre>_______________________________________________
noPoll mailing list
<a href="mailto:noPoll@lists.aspl.es">noPoll@lists.aspl.es</a>
<a href="http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll">http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll</a>

</pre>
</td>
</tr>
</tbody></table>
</blockquote>
<table cellspacing="0" cellpadding="0" width="100%">
<tbody><tr>
<td>
<pre></pre></td></tr></tbody></table></blockquote></body></html>