Not logged in. · Lost password · Register
Forum: MatriX RSS
Page:  1  2  next
Avatar
Arthur #1
Member since Feb 2010 · 13 posts
Group memberships: Members
Show profile · Link to this post
Subject: Bosh example?
Can you provide an example/additional documentation on connecting using Bosh?

This is what I tried using your MiniClient example

xmppClient2.Transport = Matrix.Net.Transport.BOSH;
xmppClient2.Port = 7443;
xmppClient2.Uri = new System.Uri("http://mydomain.com");
xmppClient2.Open();

Here is my result XML:
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="mydomain.com" version="1.0" >

It just hangs and keeps trying to "SEND" nothing

I'm using an Openfire server.  Thanks.
This post was edited on 2010-02-08, 23:27 by Arthur.
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
the Bosh domain in Openfire has the format http://mydomain.com/http-bind/
The rest of your code looks ok to me.

Alex
Avatar
Arthur #3
Member since Feb 2010 · 13 posts
Group memberships: Members
Show profile · Link to this post
Thanks for the reply.  Unfortunately I still get the same results.

Here is the actual method I'm using.  I added a button to the MiniClient example that calls this method.
Any other suggestions?  Is there something I'm missing?  Is there a specific server configuration I need to set?
Thanks again.

XmppClient xmppClient2 = new XmppClient();

xmppClient2.Username = "arthur";  //e.g. maltin
xmppClient2.Password = "password";  //e.g. secret
xmppClient2.XmppDomain = "mydomain.com";

xmppClient2.StartTls = false;
xmppClient2.Transport = Matrix.Net.Transport.BOSH;
xmppClient2.Port = 7070; //http
xmppClient2.Uri = new System.Uri("http://mydomain.com/http-bind/");
           
xmppClient2.OnLogin += new System.EventHandler<Matrix.EventArgs>(this.xmppClient_OnLogin);
xmppClient2.OnSendXml += new System.EventHandler<Matrix.TextEventArgs>(this.xmppClient_OnSendXml);
xmppClient2.OnIq += new System.EventHandler<Matrix.Xmpp.Client.IqEventArgs>(this.xmppClient_OnIq);
xmppClient2.OnReceiveXml += new System.EventHandler<Matrix.TextEventArgs>(this.xmppClient_OnReceiveXml);
xmppClient2.OnValidateCertificate += new System.EventHandler<Matrix.CertificateEventArgs>(this.xmppClient_OnValidateCertificate);
xmppClient2.OnMessage += new System.EventHandler<Matrix.Xmpp.Client.MessageEventArgs>(this.xmppClient_OnMessage);
xmppClient2.OnAuthError += new System.EventHandler<Matrix.Xmpp.Sasl.SaslEventArgs>(this.xmppClient_OnAuthError);
xmppClient2.OnRosterStart += new System.EventHandler<Matrix.EventArgs>(this.xmppClient_OnRosterStart);
xmppClient2.OnPresence += new System.EventHandler<Matrix.Xmpp.Client.PresenceEventArgs>(this.xmppClient_OnPresence);
xmppClient2.OnRosterItem += new System.EventHandler<Matrix.Xmpp.Roster.RosterEventArgs>(this.xmppClient_OnRosterItem);
xmppClient2.OnRosterEnd += new System.EventHandler<Matrix.EventArgs>(this.xmppClient_OnRosterEnd);
xmppClient2.OnError += new System.EventHandler<Matrix.ExceptionEventArgs>(this.xmppClient_OnError);
xmppClient2.OnClose += new System.EventHandler<Matrix.EventArgs>(this.xmppClient_OnClose);
xmppClient2.OnBind += new System.EventHandler<Matrix.JidEventArgs>(this.xmppClient_OnBind);
xmppClient2.OnStreamError += new System.EventHandler<Matrix.StreamErrorEventArgs>(this.xmppClient_OnStreamError);

xmppClient2.Open();
Avatar
Alex #4
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
what do you see when you try to access the URL http://mydomain.com/http-bind/ with a web browser?

Alex
Avatar
Alex #5
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
oh, and the port must be part of the domain. The Port property is not used with BOSH. So when BOSH is not running on port 80 then the URL should have this format: http://mydomain.com:5280/http-bind/

Alex
Avatar
Arthur #6
Member since Feb 2010 · 13 posts
Group memberships: Members
Show profile · Link to this post
Success!  You are correct, we're not running on port 80 so after adding the port to the URI property it worked.

Thanks again!
Avatar
Alex #7
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
great, but I suggest to use direct connection whenever possible- BOSH was developed for web browsers and other constrained clients which cannot open sockets and only communicate over HTTP.

Alex
Avatar
Arthur #8
Member since Feb 2010 · 13 posts
Group memberships: Members
Show profile · Link to this post
Ok thanks, we'll keep that in mind.  We have another question, when we connect using Bosh we only get the "OnLogin" event.  We don't get any "OnRoster" or "OnPresence" events and we don't see any of the other registered users.  I'm using the same code mentioned before. 

I've tried adding

xmppClient2.AutoPresence = true;
xmppClient2.AutoRoster = true;

This is not working.

Any suggestions?

Thanks.
Avatar
Alex #9
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
can you post the Xml debug? There was a bug in Openfires BOSH implementation a while ago, and I don't know if its fixed in the latest version.

Alex
Avatar
Arthur #10
Member since Feb 2010 · 13 posts
Group memberships: Members
Show profile · Link to this post
Here you go:

This is the XML with AutoPresence and AutoRoster set to true


SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="mydomain.com" version="1.0" >
RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="mydomain.com" version="1.0" id="2a58bcb5" >
RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>DIGEST-MD5</mechanism>
    <mechanism>PLAIN</mechanism>
    <mechanism>ANONYMOUS</mechanism>
    <mechanism>CRAM-MD5</mechanism>
  </mechanisms>
  <compression xmlns="http://jabber.org/features/compress">
    <method>zlib</method>
  </compression>
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
</stream:features>
SEND: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09ImtkMTE0OTlhLm1pdGNoZWxsLmNvbSIsbm9uY2U9ImlyWkp2WXc2QW5LM3FrMWk2Z1NVa1NtZGRPYVNXSUYvd3VUQ01TY1EiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=</challenge>
SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9ImFydGh1ciIscmVhbG09ImtkMTE0OTlhLm1pdGNoZWxsLmNvbSIsbm9uY2U9ImlyWkp2WXc2QW5LM3FrMWk2Z1NVa1NtZGRPYVNXSUYvd3VUQ01TY1EiLGNub25jZT0iNDFjYzI3MmFmZDUxODllOWFlODE2ZGRhMDQ4MmQyZWI5NzhmMGY0OTNkZmY1MzU3NTgxYzAyYTBiNTViMTQzMiIsbmM9MDAwMDAwMDEscW9wPWF1dGgsZGlnZXN0LXVyaT0ieG1wcC9rZDExNDk5YS5taXRjaGVsbC5jb20iLGNoYXJzZXQ9dXRmLTgscmVzcG9uc2U9MDE3ZWQ3ZjBiODljZjUwNTA4YTlmYjExYjI0MjdmMmU=</response>
RECV: <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cnNwYXV0aD01NTVlNjliNzY5ZmVlNmFkODJjYzAxYzZiNmQyMDYzYg==</success>
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="mydomain.com" version="1.0" >
RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="mydomain.com" version="1.0" id="2a58bcb5" >
RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <compression xmlns="http://jabber.org/features/compress">
    <method>zlib</method>
  </compression>
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
</stream:features>
SEND: <iq id="MX_1" type="set" xmlns="jabber:client">
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
    <resource>MatriX</resource>
  </bind>
</iq>
RECV: <iq type="result" id="MX_1" to="mydomain.com/2a58bcb5" xmlns="http://jabber.org/protocol/httpbind">
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
    <jid>arthur@mydomain.com/MatriX</jid>
  </bind>
</iq>
Avatar
Alex #11
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes, as you can see the bug is still there:

the result of iq MX_1 is in a wrong Xml namespace. It's http://jabber.org/protocol/httpbind instead of jabber:client

  1. <iq type="result" id="MX_1" to="mydomain.com/2a58bcb5" xmlns="http://jabber.org/protocol/httpbind">
  2.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  3.     <jid>arthur@mydomain.com/MatriX</jid>
  4.  </bind>
  5. </iq>

Alex
Avatar
Arthur #12
Member since Feb 2010 · 13 posts
Group memberships: Members
Show profile · Link to this post
I see.  Do have any suggestions of any other servers that support Bosh?

Once again thanks for your help and quick responses.
Avatar
Alex #13
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I reported this bug a while ago to the Openfire Team, but i will try to report it again. Because Matrix is namespace correct there is no workaround. I could rewrite the namespace, but this would be a dirty hack.

You can try to use a stand alone BOSH connection manager like Punjab. Ejabberd works also fine with MatriX.

Alex
Avatar
Arthur #14
Member since Feb 2010 · 13 posts
Group memberships: Members
Show profile · Link to this post
Ok thanks.  We'll look into Punjab and Ejabberd.
Avatar
javanesevn #15
Member since Apr 2008 · 74 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
In reply to post #11
Thank you to show this bug.
This is mistyping in development.

I took a look at example 12 and 13 of XEP-0206 in correct.


Regards,
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:
Page:  1  2  next
Forum: MatriX RSS