Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
Vincent #1
Member since Sep 2010 · 15 posts
Group memberships: Members
Show profile · Link to this post
Subject: Convert from agsXMPP to Matrix
Hello,

I recently started using Matrix for facebook, which now works (thanks Alex!). However, I'm also implementing XMPP for another socialnetwork site (Hyves, if anyone is familiar) and I'm having trouble getting the same response when converting my code from an agsxmpp to a Matrix implementation.

Both agsXMPP and Matrix get the following;

  1. <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  2.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  3.     <mechanism>DIGEST-MD5</mechanism>
  4.  </mechanisms>
  5.  <auth xmlns="http://jabber.org/features/iq-auth" />
  6. </stream:features>

Matrix then receives;
  1. <stream:error xmlns:stream="http://etherx.jabber.org/streams">
  2.               <connection-timeout xmlns="urn:ietf:params:xml:ns:xmpp-streams" />
  3.             </stream:error>

agsXMPP however continues with the procedure.

  1. <iq id="agsXMPP_33" type="get" to="94.100.119.196"><query xmlns="jabber:iq:auth"><username>vince83</username></query></iq>
  2. <iq xmlns="jabber:client" type="result" id="agsXMPP_33">
  3.           <query xmlns="jabber:iq:auth">
  4.             <username />
  5.             <digest />
  6.             <resource />
  7.           </query>
  8.         </iq>

Why is my result different with Matrix?




Complete (relevant) code:

agsXMPP:
  1.         xmpp = new XmppClientConnection();
  2.         xmpp.UseSSL = false;
  3.         xmpp.UseStartTLS = false;
  4.         xmpp.Username = chatResult.Username;
  5.         xmpp.Password = chatResult.Token;
  6.         xmpp.ConnectServer = chatResult.Ip;
  7.         xmpp.Server = chatResult.Ip;
  8.         xmpp.Port = chatResult.Port;
  9.         xmpp.AutoRoster = true;
  10.         xmpp.Show = ShowType.dnd;
  11.         xmpp.Resource = "VincentTestApp";
  12.         xmpp.UseCompression = false;
  13.         xmpp.Priority = 1;
  14.         xmpp.KeepAlive = false;
  15.         xmpp.KeepAliveInterval = 1;
  16.  
  17.         xmpp.OnSaslStart += new SaslEventHandler(xmpp_OnSaslStart);
  18.         xmpp.OnReadXml += new XmlHandler(xmpp_OnReadXml);
  19.         xmpp.OnWriteXml += new XmlHandler(xmpp_OnWriteXml);
  20.         xmpp.OnIq += new IqHandler(xmpp_OnIq);
  21.  
  22.         xmpp.Open();
  23.  
  24. ##################
  25.  
  26.     void xmpp_OnSaslStart(object sender, SaslEventArgs args) {
  27.         args.Auto = false;
  28.         args.Mechanism = agsXMPP.protocol.sasl.Mechanism.GetMechanismName(agsXMPP.protocol.sasl.MechanismType.NONE);
  29.     }

Matrix:
  1.         xmppClient = new XmppClient();
  2.  
  3.         xmppClient.SetXmppDomain(chatResult.Ip);
  4.         xmppClient.Port = chatResult.Port;
  5.         xmppClient.SetUsername(chatResult.Username);
  6.         xmppClient.SetResource("VincentTestApp");
  7.         xmppClient.Password = chatResult.Token;
  8.  
  9.         xmppClient.Status = "Online";
  10.         xmppClient.Show = Matrix.Xmpp.Show.dnd;
  11.         xmppClient.Priority = 1;
  12.         xmppClient.KeepAliveInterval = -1;
  13.         xmppClient.StartTls = false;
  14.         xmppClient.Compression = false;
  15.  
  16.         xmppClient.AutoRoster = true;
  17.  
  18.         xmppClient.OnBeforeSasl += new EventHandler<Matrix.Xmpp.Sasl.SaslEventArgs>(xmppClient_OnBeforeSasl);
  19.         xmppClient.OnReceiveXml += new EventHandler<Matrix.TextEventArgs>(xmppClient_OnReceiveXml);
  20.         xmppClient.OnSendXml += new EventHandler<Matrix.TextEventArgs>(xmppClient_OnSendXml);
  21.  
  22.         xmppClient.Open();
  23.  
  24. ####################
  25.  
  26.     void xmppClient_OnBeforeSasl(object sender, Matrix.Xmpp.Sasl.SaslEventArgs e) {
  27.         e.Auto = false;
  28.         e.SaslMechanism = Matrix.Xmpp.Sasl.SaslMechanism.NONE;
  29.     }
This post was edited on 2010-10-11, 15:52 by Vincent.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi Vincent,

which MatriX version are you using to connect to this server?
The server offers only Digest-MD5 Sasl authentication and old jabber style authentication. Old jabber authentication is not implemented in MatriX because every XMPP compliant jabber server should advertise SASL mechanisms and normally they all offer SASL Plain.

So the problem here is that it offers only Digest-MD5 which wasn't implemented in the Mobile, Silverlight and Windows Phone 7 version until last week because some crypto algorithm were missing in the .NET SDKs. In the meantime I have added the crypto algorithms as managed code and all MatriX versions have DIGEST-MD5 now. When you let me know which MatriX version you are using then I can upload a new build with Digest-MD5 support. MatriX will connect fine then.

Alex
Avatar
Vincent #3
Member since Sep 2010 · 15 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

I'm using the Matrix.Net which you provided when I had facebook connection problems.

As for the authentication method. Should I be using PLAIN as opposed to NONE?

Regards,
Vincent
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
please try the latest version from the download page, this should work.

Alex
Avatar
Alex #5
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
and don't overwrite anything in the OnBeforeSasl event, because this server supports only Digest-MD5.
I tried it with the latest version and have no problem to initialize authentication with this server.

Alex
Avatar
Vincent #6
Member since Sep 2010 · 15 posts
Group memberships: Members
Show profile · Link to this post
Despite the Digest-MD5 which the server returns I should be able to connect using the method I'm using in the agsXMPP code. (Strange yes, but I've checked with the developers from the XMPP server I'm connecting to and they confirmed.) That's why I'm setting the mechanism in the BeforeSasl event.

I've tried the latest version, both with mechanism none and plain but still the same outcome. Not setting the Sasl mechanism does indeed start an authentication but the token I receive from their API is not intended for this authentication method.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: