<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/4.2.2">
</HEAD>
<BODY>
<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%">
<TR>
<TD>
<PRE>
--
Francis Brosnan Blázquez - ASPL
<A HREF="http://www.asplhosting.com/">http://www.asplhosting.com/</A>
<A HREF="http://www.aspl.es/">http://www.aspl.es/</A>
<A HREF="https://twitter.com/aspl_es">https://twitter.com/aspl_es</A>
<A HREF="https://twitter.com/asplhosting">https://twitter.com/asplhosting</A>
<A HREF="https://twitter.com/francisbrosnanb">https://twitter.com/francisbrosnanb</A>
<A HREF="https://es.linkedin.com/in/francis-brosnan-bl">https://es.linkedin.com/in/francis-brosnan-bl</A>ázquez-1353a218
91 134 14 22 - 91 134 14 45 - 91 116 07 57
AVISO LEGAL
En virtud de lo dispuesto en la Ley Orgánica 15/1999, de 13 de
diciembre, de Protección de Datos de Carácter Personal, le informamos de
que sus datos de carácter personal, recogidos de fuentes accesibles al
público o datos que usted nos ha facilitado previamente, proceden de
bases de datos propiedad de Advanced Software Production Line, S.L.
(ASPL).
ASPL garantiza que los datos serán tratados con la finalidad de mantener
las oportunas relaciones comerciales o promocionales con usted o la
entidad que usted representa. No obstante, usted puede ejercitar sus
derechos de acceso, rectificación, cancelación y oposición dispuestos en
la mencionada Ley Orgánica, notificándolo por escrito a ASPL -
Protección Datos, C/Antonio Suárez 10 A-102, 28802, Alcalá de Henares
(Madrid).
</PRE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>