[jdev] XMPP Ping/Keepalive: Recommended method ?

Sergei Golovan sgolovan at gmail.com
Mon Jun 19 02:15:40 CDT 2006


On 6/19/06, Michal vorner Vaner <michal.vaner at kdemail.net> wrote:
> On Sun, Jun 18, 2006 at 10:47:19PM -0700, ennova2005-jabber at yahoo.com wrote:
> >    Given that the protocol itself does not seem to have a defined keep-alive
> >    element, what is the recommended way for a client to keep its connection
> >    alive to a XMPP server ?
>
> Since XML allows any number of whitespace between elements that is just
> ignored, you can send a whitespace if you are not in the middle of
> stanza. It will do, NATs and other beasts will see data flowing,

The problem is that this "ping" is not a ping at all because it only
sends data and does not expect reply.

So, some NATs and proxies still break connection if they don't see
bidirectional flow.

Another issue is that with this "ping" you can't control the
connection. If TCP connection breaks (but before TCP timeout reaches -
and it is a quite long timeout) both messages and "pings" goes to
black hole and there's no way to work around this (to set some short
internal timeout or whatever).

-- 
Sergei Golovan



More information about the JDev mailing list