XMPP Connection Not Reconnecting

Dear Smack Team,

We have been Smack and it’s amazing. Thank you for all the great work for it!

We have been struggling with some connection issues for a while now and tried a lot to debug it. Basically, when our app is using the Mobile Network Data ( instead of Wifi ), the connection closes on error and Reconnection does not happen. Attaching images of the error messages we see on the client side.

We have looked at several different sources online also and based on that we are connecting to the server as follows:

XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
configBuilder.setUsernameAndPassword(username, password);
configBuilder.setHost(server);
configBuilder.setXmppDomain(domain);
configBuilder.setPort(port);
configBuilder.setResource(androidDeviceId);
configBuilder.setKeystoreType(null);
configBuilder.setConnectTimeout(120000);
configBuilder.setSendPresence(true);
configBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
configBuilder.setDebuggerFactory(new DebuggerFactory());

try {
TLSUtils.acceptAllCertificates(configBuilder);
} catch (NoSuchAlgorithmException | KeyManagementException e) {
e.printStackTrace();
}
SASLAuthentication.unBlacklistSASLMechanism(“c”);
SASLAuthentication.blacklistSASLMechanism(“SCRAM-SHA-1”);
SASLAuthentication.blacklistSASLMechanism(“DIGEST-MD5”);
final Map<String, String> registeredSASLMechanisms = SASLAuthentication.getRegisterdSASLMechanisms();
for (String mechanism : registeredSASLMechanisms.values()) {
SASLAuthentication.blacklistSASLMechanism(mechanism);
}
SASLAuthentication.unBlacklistSASLMechanism(SASLPlainMechanism.NAME);

connection = new XMPPTCPConnection(configBuilder.build());
connection.addConnectionListener(connectionListener);
connection.setUseStreamManagement(true);
connection.setUseStreamManagementResumption(true);
ReconnectionManager reconnectionManager = ReconnectionManager.getInstanceFor(connection);
reconnectionManager.enableAutomaticReconnection();

pingManager = PingManager.getInstanceFor(connection);
pingManager.setPingInterval(480);

connection.connect();
connection.login(username, password);

//Once Connection got authenticated enabling ServerPing
ServerPingWithAlarmManager.getInstanceFor(connection).setEnabled(true);

We would be very grateful if you can guide us on what we could be doing wrong. This is critical to our user experience and messages are sent frequently within the app and growing quickly.

regards,
Sathish

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.