<!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>
Buenas Rami,<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
gracias pur la rapida respuesta,<BR>
</BLOCKQUOTE>
<BR>
De nada :-)<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
So, I understand (I'm quite new to Web-Sockets) that the native PING/PONG utility <B>is for holding a socket open</B> (above the TCP keep-alive, that may not be configured),<BR>
</BLOCKQUOTE>
<BR>
That's right,<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<B>not for validating the socket</B>?<BR>
</BLOCKQUOTE>
<BR>
Uhmn...I'm not sure about what you mean here, but certainly, it is, mostly, for holding<BR>
the connection open,<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
If that is the case - I agree, the application-layer shouldn't know about it.<BR>
</BLOCKQUOTE>
<BR>
Ok,<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
And, if my Web-Socket client needs to 'manually' send a PING upon an application-configured timeout, it may already send an application-level PING (as you suggested at the end of your reply). The only difference will be adding the application-level PING to both client and server, as apposed to add the "on ping received" handler within the noPoll lib.<BR>
</BLOCKQUOTE>
<BR>
That's right,<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
I wonder if adding a PING (say - every 30 seconds) will fix the disconnection issues...<BR>
</BLOCKQUOTE>
<BR>
Possibly. Try to see what happens. Just clarify that there's nothing in noPoll that will<BR>
close the connection after some inactivity period ...even in the RFC, so if you are receiving<BR>
a connection close/disconnect, maybe it is a matter of checking why is that happening too<BR>
(at the server side), and also consider a connection issue itself,<BR>
<BR>
For example, in one of our cases, we use noPoll for server side Core-Admin [1] component <BR>
and it provides support to web-client incoming connections using WebSocket that lasts days <BR>
or weeks running the same connection. In that context, no ping (application level nor <BR>
WebSocket) is used..<BR>
<BR>
Best Regards,<BR>
<BR>
[1] <A HREF="http://www.core-admin.com">http://www.core-admin.com</A><BR>
<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
Thanks again.<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
On 15 November 2015 at 12:27, Francis Brosnan Blázquez <<A HREF="mailto:francis@aspl.es">francis@aspl.es</A>> wrote:
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BLOCKQUOTE>
El dom, 15-11-2015 a las 00:30 +0200, Rami Rosenbaum escribió: <BR>
<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,
<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>
Rami<BR>
<BR>
<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>
</BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</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>