[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Hi Jorg,
Thanks for the work-around tip. My only caution is that disabling the
close notification may prove problematic if the connection is not
reestablished quickly.
Hopefully with the cooperation of Jorg, Ali, and others in the community
we can get a contribution in place to add the reconnect option to the
xmpp provider in fairly short order. Those interested and/or willing to
contribute please join/contribute to this bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=313028
Scott
Jörg Rathlev wrote:
Hi Ali,
Ali Naddaf schrieb:
Thank you Scott. I have made some progress there and hopefully soon will
have a complete working example that I can share in case you would be
interested in posting that. I am sure I will have some questions on the
way but one that I ran into is the following: if I make a connection
(using container.connect(...)), and if I lose connectivity (due to
network) and gain internet connectivity again, I will not be reconnected
automatically. If I were to use the smack libraries directly to connect
to a jabber server, it would reconnect automatically so is there an
option there that I can enable this feature?
I ran into the same issue in a project I worked on last year. The
reconnect feature of the Smack library theoretically works, but ECF
internally handles the disconnected event by explicitly closing the
connection. The way we worked around this problem was by simply
disabling the forwarding of the event in the ECFConnection. There is an
internal ConectionListener in ECFConnection which listens on the Smack
connection. In that listener, simply disable the call to
handleConnectionClosed(e) in connectionClosedOnError:
private final ConnectionListener connectionListener = new
ConnectionListener() {
public void connectionClosed() {
handleConnectionClosed(new IOException("Connection reset by peer"));
}
public void connectionClosedOnError(Exception e) {
// Handling disabled to make automatic reconnection by Smack 3.1
// work.
// handleConnectionClosed(e);
Obviously, that is not a clean solution, but it did the job for our use
case. I guess it would have some side effects if one tries to use the
connection while it is interrupted. Unfortunately I did not have the
time to find a better solution, and I am now no longer working on that
project.
Anyway, I hope this will help you to find a solution for your case.
Cheers
Jörg