Devos50
Devos50

Reputation: 2035

XMPP framework for iOS very slow when connecting

I'm currently working on a chat client which I'm building with the XMPP framework. I've explored the demo app and I noticed that when I enter my username/password, it's taking a very long time (about 15 seconds) to receive the connect and authentificate callbacks.

Is there a specific reason why it's taking so long to login and authenticate? Is it somehow possible to speed it up? Whatsapp or iChat for example is also using xmpp and it's very fast.

I'm using ejabberd as XMPP server on a Mac running 10.8 and xCode 4.4.

Thanks in advance!

Upvotes: 0

Views: 1497

Answers (3)

DAMM108
DAMM108

Reputation: 960

SRV lookup takes the time thats why you are facing the problem

Resolve this by Setting [xmppStream setHostName: @"******"];

More explanation below

  • This hostName property is optional.
  • If you do not set the hostName, then the framework will follow the xmpp specification using jid's domain.
  • That is, it first do an SRV lookup (as specified in the xmpp RFC).
  • If that fails, it will fall back to simply attempting to connect to the jid's domain.

Upvotes: 2

Etan Reisner
Etan Reisner

Reputation: 81012

Following up on the email thread I agree with ppolv that DNS timeouts are likely related here. Do you have SRV entries configured for your domain? Are they correct? If you dump the traffic generated by Psi and Trillian do you see a difference in DNS requests between them?

Upvotes: 0

ppolv
ppolv

Reputation: 1319

Not sure about your case, but some clients had these kind of delays when they perform DNS lookup for the server' domain. The workflow is to first search for SRV records, as expected by the XMPP spec. If there is no SRV record for the domain, then fallback and try to connect to the domain directly, at the expected 5222 port. But that procedure of first trying with SRV and then fallback can consume a few seconds.
If this is your case, you could configure your client to connect to the server without doing SRV lookups, or correctly setup the SRV records for your domain.

Upvotes: 2

Related Questions