esl / MongooseIM

MongooseIM is Erlang Solutions' robust, scalable and efficient XMPP server, aimed at large installations. Specifically designed for enterprise purposes, it is fault-tolerant and can utilise the resources of multiple clustered machines.
Other
1.67k stars 428 forks source link

Can't loged in on mongooseim server using xmppframework in ios #461

Closed WarisSaqi closed 9 years ago

WarisSaqi commented 9 years ago

Hi All, I have to implement chat in my application in iOS using MongooseIM but it can't let me log in to the server and give me the error "Socket closed by remote peer". While i test the app using Buddy-Cloud and Tigase server it works perfectly fine using XmppFramework. Is there any additional perameters for MongooseIM with Xmpp or something else i missed.

fenek commented 9 years ago

Can you please check in XmppFramework logs what XML stanzas are sent and received by the device? If we could take a look, it would be easier to find the cause of the problem.

michalwski commented 9 years ago

MongooseIM logs would be also very helpful :)

WarisSaqi commented 9 years ago

This is the error in method xmppStreamDidDisconnect:withError:

Error Domain=GCDAsyncSocketErrorDomain Code=7 "Socket closed by remote peer" UserInfo=0x16aa6600 {NSLocalizedDescription=Socket closed by remote peer

michalwski commented 9 years ago

This doesn't say much unfortunately. Could you please check what stanzas are sent from client to the server?

WarisSaqi commented 9 years ago

Sorry for delay... Here is the stanzas sent by client to server and receive from server using xmppframework

SEND: <?xml version='1.0'?>
SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='tellmo.net'>
RECV: <stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" id="1061431089" from="tellmo.net" version="1.0" stream1:lang="en"/>
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><register xmlns="http://jabber.org/features/iq-register"/><sm xmlns="urn:xmpp:sm:3"/></stream:features>
SEND: <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="SCRAM-SHA-1">biwsbj13YXJpc3NoYW1zLHI9ODA5OUVCMUYtRDlCQi00MDI2LUJBNTktQTgyRUQ2NEVCRDNB</auth>
RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cj04MDk5RUIxRi1EOUJCLTQwMjYtQkE1OS1BODJFRDY0RUJEM0FVYTQreXp5cmphUTlvcHdrMjhjZFNnPT0scz1pWGFCa01Eb2Noa2ZVdFRsa2FIZGZnPT0saT00MDk2</challenge>
SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">Yz1iaXdzLHI9ODA5OUVCMUYtRDlCQi00MDI2LUJBNTktQTgyRUQ2NEVCRDNBVWE0K3l6eXJqYVE5b3B3azI4Y2RTZz09LHA9K25leG9QZHoxNTRaTVpBemRidnQ5VjNjQU13PQ==</response>
RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><bad-auth/></failure>
michalwski commented 9 years ago

Sth's wrong with the authentication. I have some other questions now:

  1. Are you sure the user is registered on the server?
  2. Did you try other auth method than SCRAM-SHA-1?
WarisSaqi commented 9 years ago

yes user is registered on server. and connected using Adium as well but in my app its not connecting. i uses the default auth methods as XMPPFramework use. And XMPPFramework using SASLAuthentication

michalwski commented 9 years ago

Adium is not using SCRAM-SHA-1 mechanism so this means there's sth wrong with this mechanism. Few more questions. Are you sure the your app also used SCRAM-SHA-1 when tried with Buddy-Cloud or Tigase?

Spiking about default mechanism. The server advertises what is supported and the client library chooses one of the mechanisms. It is possible that in case of Buddy-Cloud and Tigase the framework took other mechanism based on the advertised mechanisms.

WarisSaqi commented 9 years ago

I don't know which authentication used by XMPPFramework for Buddy-Cloud and Tigase because i don't apply any extra settings for authentication it choose it self for both. XMPPFramework supports MD5, SCRAM-SHA1, OAUTH2-google, SASL and plan authentication.

michalwski commented 9 years ago

Ok, please try DIGEST-MD5 with MongooseIM and see if it works.

WarisSaqi commented 9 years ago

Thanks so much.. I successfully logged in using DIGEST-MD5

WarisSaqi commented 9 years ago

Can you give me some suggestions to send Image via MongooseIM chat

ppikula commented 9 years ago

Take a look at this issue https://github.com/esl/MongooseIM/issues/407. You can upload image to the media server/storage and then send a link inside a message.