<!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>
El dom, 15-11-2015 a las 00:30 +0200, Rami Rosenbaum escribió:
<BLOCKQUOTE TYPE=CITE>
Hola,<BR>
</BLOCKQUOTE>
<BR>
Hola Rami!<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
Hablo muy male Espaniol, losiento...<BR>
</BLOCKQUOTE>
<BR>
Don't worry, I really appreciate your effort! <BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
I'm using noPoll WebSocket lib within my Qt application (4.8 - no native web-socket API).<BR>
</BLOCKQUOTE>
<BR>
Right,<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
Due to socket disconnections I added the PING-PONG functionality.<BR>
</BLOCKQUOTE>
<BR>
Ok,<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
My intention was to recreate the web-socket if n PINGs fail.<BR>
Looking at the noPoll logs - I'm receiving PONGs.<BR>
<B>Ho do I know if the PING fails?</B><BR>
The call nopoll_conn_send_ping() always returns (2), even on success...<BR>
</BLOCKQUOTE>
<BR>
Ok, several elements here. In one hand, going to your question, if nopoll_conn_send_ping<BR>
returns 2, it means it succeeded and it sent the PING frame. So if you run the following<BR>
code you can check if it failed:<BR>
<BR>
if (! nopoll_conn_send_ping (conn)) {<BR>
// handle ping failure here<BR>
}<BR>
<BR>
At the other hand, nopoll_conn_send_ping shouldn't be returning (2) but nopoll_true or<BR>
nopoll_false. I've updated github repo to include a fix to make this,
<BLOCKQUOTE>
<PRE>
</PRE>
</BLOCKQUOTE>
<PRE>
<A HREF="https://github.com/ASPLes/nopoll/commit/b78aa65b5e9a44c2673cb0b125f88412de7f3c75">https://github.com/ASPLes/nopoll/commit/b78aa65b5e9a44c2673cb0b125f88412de7f3c75</A>
</PRE>
<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
If I disconnect the internet connection - how can I catch a 'fail' or timeout?<BR>
</BLOCKQUOTE>
<BR>
Ok, for a failure, you can connect a handler to get a connection close using:<BR>
<BR>
nopoll_conn_set_on_close (conn, on_disconnect_handler)<BR>
<BR>
...but for the timeout, possibly we can add an "on pong received" handler, so you<BR>
can set a timeout and if that timeout is reached (without being cancelled by the code<BR>
at your "on pong received") then you can consider timeout reached and close the connection<BR>
or handle the way it is needed.<BR>
<BR>
However, currently, as PING/PONG frames are defined now, they are more for a keep alive mechanism to ensure<BR>
the transport is working instead of handling timeouts... for example, ping/pong frames do not <BR>
have an indicator so you can track what ping frame is being replied when a pong is received..<BR>
<BR>
Having said that, I think the best way to go here is you send an application level "ping" that<BR>
your application can reply/handle (even including some state) and then inside your on msg received<BR>
handler you can also check if there are pending replies or if a timeout was reached,<BR>
<BR>
Best Regards,<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
Thanks,<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
Rami<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<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>
</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>
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>