Auto Reconnect and a list of events that can be fired?

36 views
Skip to first unread message

Mac

unread,
Mar 9, 2012, 9:38:25 AM3/9/12
to Blather
I'm wondering if there is a way to improve the connectivity
robustness?

I am using Blather as an API and found that I can listen for
the :disconnected event and do client.connect to reconnect to the
server.

client.register_handler :disconnected do
$log.info "Disconnected from server! Reconnecting"
client.connect
end

This works well, but I was wondering about the situation where the
server may be offline for a period of time and I would reconnect when
it came back online.

I see that I can add a connection timeout to the Blather::Client.setup
method, but what event gets fired on timeout so I can tell the
connection to start connecting again? Do I even need to do this, or
does the api handle this for me?

Also is there a page somewhere the has a list of the different events
that Blather can fire? Obviously it wouldn't be exhaustive, but even
if it was just the events that the core API fires it would be a
tremendous help.

Thanks,

Brian

Ben Langfeld

unread,
Mar 9, 2012, 10:04:18 AM3/9/12
to xmpp-b...@googlegroups.com
Brian,

You need something that makes reconnect attempts with an exponential
backoff. This is not included in Blather. Blather will fire
:disconnected when the connection times out. The timeout is there to
handle the case where the server socket is alive, but does not respond
to the XMPP stream.

As for a list of handlers, you can inspect
Blather::Client#current_handlers for a full list, or a slightly old
list here: http://blather.squishtech.com/handlers

Regards,
Ben Langfeld

> --
> You received this message because you are subscribed to the Google Groups "Blather" group.
> To post to this group, send email to xmpp-b...@googlegroups.com.
> To unsubscribe from this group, send email to xmpp-blather...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/xmpp-blather?hl=en.
>

Reply all
Reply to author
Forward
0 new messages