Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
gtko #1
Member since Oct 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: How can I use MucManager?
Hi everyone. I'm trying to make a simple demo app using xmpp.
My environment is Unity3D, and MatriX for Mono.

I could make a connection to my xmpp server(openfire), and succeeded  to make a chat with other clients(spark, adium...).

Now I'm trying to make a multi user chat with MucManager, but I can't make.
When I call MucManager.EnterRoom, connection is disappeared.. here is my code.
What's my mistake?

XmppClient _xmppClient = null;
MucManager _mucManager = null;

  1. void Start () {
  2.     input.onSubmit = onsubmit;
  3.    
  4.     _xmppClient = XmppManager.instance.xmpp; //my singleton instance
  5.     _mucManager = XmppManager.instance.muc; //my singleton instance
  6.    
  7.     Connect ();
  8. }
  9.  
  10. public bool Connect() {
  11.        try {
  12.         _xmppClient.SetUsername("myID");
  13.         _xmppClient.Password = "password";
  14.         _xmppClient.SetXmppDomain("my-pc");
  15.        
  16.         _xmppClient.ResolveSrvRecords = false;
  17.         _xmppClient.Hostname = "192.168.3.125";
  18.         _xmppClient.Port = 5222;
  19.  
  20.         _xmppClient.Status = "I can chat";
  21.         _xmppClient.Show = Matrix.Xmpp.Show.chat;
  22.         _xmppClient.AutoRoster = true;
  23.         _xmppClient.AutoPresence = true;
  24.         _xmppClient.OnMessage += xmppClient_OnMessage;
  25.         _xmppClient.OnLogin += xmppClient_OnLogin;
  26.         _xmppClient.OnPresence += xmppClient_OnPresence;
  27.        
  28.         _xmppClient.Open();
  29.        
  30.         return true;
  31.         } catch (Exception ex) {
  32.         Debug.Log(ex.ToString());
  33.            return false;
  34.         }
  35. }
  36.  
  37. private void xmppClient_OnLogin(object sender, Matrix.EventArgs e) {
  38.     Join(); //if xmppClient is OK, try to join chat room
  39. }
  40.  
  41. public bool Join() {
  42.     try {
  43.         Debug.Log ("join");
  44.  
  45. //I've already made the group chat room name 'aaaa' with openfire server admin page.
  46.  
  47.         Jid jid = new Jid("aaaa@conference.my-pc");
  48.         _xmppClient.PresenceFilter.Add (jid, new BareJidComparer(), presenceCallback);
  49.         _mucManager.EnterRoom(jid, "nick");
  50.         return true;
  51.         } catch (Exception ex) {
  52.         return false;
  53.         }
  54. }

-------------------------------------------------------
No error logs but no connection appeared in server admin page. can you help me?
Avatar
Alex #2
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Please post your Xml logs, then we can see what happens when you try to join the room.
Avatar
gtko #3
Member since Oct 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
Error Code 401!!!!!

  1. SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="irisneoze-pc" version="1.0" >
  2. RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="irisneoze-pc" id="36ff9c9a" xml:lang="en" version="1.0" >
  3. RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  4.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  5.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  6.     <mechanism>DIGEST-MD5</mechanism>
  7.     <mechanism>PLAIN</mechanism>
  8.     <mechanism>ANONYMOUS</mechanism>
  9.     <mechanism>CRAM-MD5</mechanism>
  10.  </mechanisms>
  11.  <compression xmlns="http://jabber.org/features/compress">
  12.     <method>zlib</method>
  13.  </compression>
  14.  <auth xmlns="http://jabber.org/features/iq-auth" />
  15.  <register xmlns="http://jabber.org/features/iq-register" />
  16. </stream:features>
  17. SEND: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  18. RECV: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  19. SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="irisneoze-pc" version="1.0" >
  20. RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="irisneoze-pc" id="36ff9c9a" lang="en" version="1.0" >
  21. RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  22.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  23.     <mechanism>DIGEST-MD5</mechanism>
  24.     <mechanism>PLAIN</mechanism>
  25.     <mechanism>ANONYMOUS</mechanism>
  26.     <mechanism>CRAM-MD5</mechanism>
  27.  </mechanisms>
  28.  <compression xmlns="http://jabber.org/features/compress">
  29.     <method>zlib</method>
  30.  </compression>
  31.  <auth xmlns="http://jabber.org/features/iq-auth" />
  32.  <register xmlns="http://jabber.org/features/iq-register" />
  33. </stream:features>
  34. SEND: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
  35. RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09ImlyaXNuZW96ZS1wYyIsbm9uY2U9ImVjWERYK0VBZUdYblhEQnUrRVFaVWkyUk4wN1pXM1lPN3RSaDZGT1UiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=</challenge>
  36. SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9ImlyaXNuZW96ZSIscmVhbG09ImlyaXNuZW96ZS1wYyIsbm9uY2U9ImVjWERYK0VBZUdYblhEQnUrRVFaVWkyUk4wN1pXM1lPN3RSaDZGT1UiLGNub25jZT0iY2U4YjMxNjBmNjQwZGY3NjBjY2MyNTQ3YmRiMTFmODE1ODQ2ODE4ODM3MDVlYTY2NWU4ZWQ3ZWNlOGY3NTEzMiIsbmM9MDAwMDAwMDEscW9wPWF1dGgsZGlnZXN0LXVyaT0ieG1wcC9pcmlzbmVvemUtcGMiLGNoYXJzZXQ9dXRmLTgscmVzcG9uc2U9MmRlNjg4MTMwYTc4ZTMxNDZjNTUwOTVjOGEzYWY0MmI=</response>
  37. RECV: <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cnNwYXV0aD03MmRiM2MxMDY3Mzc3NDdhOTRhOGVhYmU0OWQ4YjBiYw==</success>
  38. SEND: <presence to="aaaa@conference.irisneoze-pc/irisneoze" xmlns="jabber:client">
  39.  <x xmlns="http://jabber.org/protocol/muc" />
  40. </presence>
  41. SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="irisneoze-pc" version="1.0" >
  42. RECV: <presence to="irisneoze-pc/36ff9c9a" type="error" >
  43. RECV: <x xmlns="http://jabber.org/protocol/muc" />
  44. RECV: <error code="401" type="auth">
  45.  <not-authorized xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  46. </error>
  47. RECV: </stream:stream>
  48. SEND: </stream:stream>
This post was edited 2 times, last on 2013-10-07, 11:25 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you try to join the room to early, your connection is not ready.
Please wait until you get the first incoming OnPresence event, or until you got the OnRosterEnd event.
Avatar
gtko #5
Member since Oct 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
WoooooW....!!!!!! it works! I was an idiot.... :(
Thank you Alex!
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:
Forum: MatriX RSS