XMPP component: keeping multiple remote connections alive

206 views
Skip to first unread message

rekado

unread,
Jul 10, 2013, 10:10:53 PM7/10/13
to xmpp-b...@googlegroups.com
Hi,

I'm building a server component with Blather that sends messages to an
(at build-time) unknown number of remote XMPP servers. I noticed the
following problem:

When sending a stanza to a remote server, waiting for about 300 seconds
and sending another stanza the remote server will not respond a second
time. This does not happen when the send-interval is less than 300
seconds. It appears that the TCP connection times out but the XML
stream continues to exist.

To prevent this situation I would like to send either whitespace
characters or full XMPP pings every 60 seconds to every remote XMPP
server to which a stream has been opened. However, as this is a server
component, there doesn't seem to be a way to obtain a list of opened
streams to remote XMPP servers to do that.

When I add an EM timer that writes a single whitespace character to the
stream, it really only sends it to the XMPP server that this component
is registered with, not the many remote XMPP servers to which I opened
streams by sending them stanzas.

Is there a way for an XMPP server component to obtain a list of active
streams to remote XMPP servers? I could then schedule a timer for each
active stream and keep the TCP connection alive by writing a ping stanza
to it.

Alternatively, is there a way to ensure that Blather closes (and
reopens) every XML stream whose underlying TCP connection has
disappeared due to a TCP timeout to avoid this problem altogether?

-- Rekado

Ben Langfeld

unread,
Jul 11, 2013, 10:43:17 AM7/11/13
to xmpp-b...@googlegroups.com
One of us has really misunderstood XMPP components, but it is my understanding that S2S streams are still the responsibility of the server, eg ejabberd, and as such if you are having problems getting stanzas to remote domains but not your home domain (ejabberd instance) then there is nothing Blather can do about the situation and you need to take it up with your XMPP server.

Regards,
Ben Langfeld



-- Rekado

--
You received this message because you are subscribed to the Google Groups "Blather" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xmpp-blather...@googlegroups.com.
To post to this group, send email to xmpp-b...@googlegroups.com.
Visit this group at http://groups.google.com/group/xmpp-blather.
For more options, visit https://groups.google.com/groups/opt_out.



rekado

unread,
Jul 12, 2013, 10:19:19 AM7/12/13
to xmpp-b...@googlegroups.com
On 07/11/2013 10:43 PM, Ben Langfeld wrote:
> One of us has really misunderstood XMPP components, but it is my
> understanding that S2S streams are still the responsibility of the
> server, eg ejabberd, and as such if you are having problems getting
> stanzas to remote domains but not your home domain (ejabberd instance)
> then there is nothing Blather can do about the situation and you need to
> take it up with your XMPP server.

Yes, managing s2s connections is the responsibility of the XMPP server.
There is, for example, a plugin for Prosody that sends XMPP pings every
60 seconds on all open s2s connections to keep them alive.

I just hoped for a *portable* solution to this problem that I could ship
with my code. If Blather doesn't keep track of remote connections
(which it certainly doesn't have to when used as a component) there is
no nice way of doing this, short of manually recording every to and from
domain and pinging them once in a while...

So I'll just make sure to mention this potential pitfall in my
documentation, recommending server plugins for keepalive if the user is
unable to adjust the TCP timeout directly.

Thanks for the confirmation.
0x235FACAC.asc
Reply all
Reply to author
Forward
0 new messages