3
votes

I want to create a chat application that uses Ejabberd as the server. I setup the ejabberd on my laptop Ubuntu 12.04 and port forward to my public ip. I try to use Pidgin(Ubuntu), Adium(MacOS), IM+(Andriod, IOS). All of them can connect and chat with each other.

However, when I follow the tutorial here http://mobile.tutsplus.com/tutorials/iphone/building-a-jabber-client-for-ios-xmpp-integration/ to build my own chat app. I got a number of issues that cant let me chat with other accounts.

Here are the messages sent and received:

2012-07-19 11:59:59:749 XMPPStream[49107:403] RosterController: awakeFromNib
2012-07-19 11:59:59:973 XMPPStream[49107:403] AppDelegate: applicationDidFinishLaunching:
2012-07-19 12:00:06:460 XMPPStream[49107:4603] SEND: <?xml version='1.0'?>
2012-07-19 12:00:06:460 XMPPStream[49107:4603] SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='xxx.xxx.xxx.xxx'>
2012-07-19 12:00:06:464 XMPPStream[49107:4603] RECV: <stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" id="1582664547" from="xxx.xxx.xxx.xxx" version="1.0" stream:lang="en"/>
2012-07-19 12:00:06:465 XMPPStream[49107:4603] RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.process-one.net/en/ejabberd/" ver="wwrSvLFOLzC92POh074kJuEqYxE="/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>
2012-07-19 12:00:06:465 XMPPStream[49107:403] RosterController: xmppStreamDidConnect:
2012-07-19 12:00:06:466 XMPPStream[49107:403] SEND: <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="DIGEST-MD5"/>
2012-07-19 12:00:06:468 XMPPStream[49107:3e0b] RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">bm9uY2U9IjIxNTYzMTM4ODEiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=</challenge>
2012-07-19 12:00:06:468 XMPPStream[49107:3e0b] SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9Imt3ZWluZXIxIixyZWFsbT0iMjAzLjIwNS4xMC4xMjciLG5vbmNlPSIyMTU2MzEzODgxIixjbm9uY2U9Ijg1RUU5MTczLTQ0RTEtNDNDMS1CNzFBLTY3OEE5NTQ2MjU1MiIsbmM9MDAwMDAwMDEscW9wPWF1dGgsZGlnZXN0LXVyaT0ieG1wcC8yMDMuMjA1LjEwLjEyNyIscmVzcG9uc2U9NzMwZWZjNzUxOWIwNzNiNDEzMGU0NjFjMmVmMjliNmIsY2hhcnNldD11dGYtOA==</response>
2012-07-19 12:00:06:502 XMPPStream[49107:4603] RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cnNwYXV0aD00YzRjMDk4ZGJhYjk2NmNiMTg3MzVhOTMyYTZhMDkxYw==</challenge>
2012-07-19 12:00:06:502 XMPPStream[49107:4603] SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>
2012-07-19 12:00:06:854 XMPPStream[49107:4603] RECV: <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>
2012-07-19 12:00:06:854 XMPPStream[49107:4603] SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='xxx.xxx.xxx.xxx'>

Here are what I observed:

  • When I turn off the ejabberd server, the client app stops working. This mean it tried to connect to the server.
  • On Android, Ubuntu, and MacOS, everytime I login it ask for accepting a certificate. But I dont see it on MY iOs app.
  • It seems that after success, it renegotiates and doesnt receive any response.
  • On the web admin of ejabberd, I dont see any online user. However, I see request is coming in the log. What documents and steps should I follow to debug XMPP application on iOS?

I'm using XCode 4.3.2 iOS 5.1 Ejabberd 2.1.11 on Ubuntu (Linux 32 bits). I tried to debug and google for 2 days but no clue

1

1 Answers

2
votes

I dig into the framework and suggested a fix here. https://github.com/robbiehanson/XMPPFramework/issues/81

It is working now. Hope it saves everyone else's time.