Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
iamdacian #1
Member since Aug 2008 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: using SocketConnectionType.Bosh instead of SocketConnectionType.Direct
hi all i am trying to switch one of my simple pub-sub tests from a SocketConnectionType.Direct to a SocketConnectionType.Bosh
the test is working nicely with SocketConnectionType.Direct and it is also working when i switch to SocketConnectionType.Bosh but, and here comes the infamous but... :)

the test has one publisher one subscriber and one pub-sub node, the publisher is publishing items every second and the subscriber is printing them out, nice and easy.

first of, there's some print outs (at console which i don't know how can i turn off: those "start webrequest" and "OnGetRequestStream" etc...

second, i see a bunch of "Web Request timed out" messages which i don't know how to interpret. it seems that the test app now is working in bursts, first is getting a bunch of timeouts, then is capable of publishing messages, and it goes again and again like that...

for me this is not correct behavior. anyone can give some input on this? thank you!

here's some of the output of the agxXMPP:

Start Webrequest: id:7
OnGetRequestStream: id:7
Write Request:
<body xmlns="http://jabber.org/protocol/httpbind" rid="857561527" key="41e3b7e133d92bc76f2c9883d97349fea9425d58" sid="2970
0003DAA" to="xmpp-02.stentor.com" />
OnEndWrite: id:7
Start Webrequest: id:8
Web Request timed out
OnGetRequestStream: id:8
Start Webrequest: id:9
Web Request timed out
OnGetRequestStream: id:9
Start Webrequest: id:10
Web Request timed out
OnGetRequestStream: id:10
Start Webrequest: id:11
Web Request timed out
OnGetRequestStream: id:11
Start Webrequest: id:12
Web Request timed out
OnGetRequestStream: id:12
Start Webrequest: id:13
OnGetResponse: id:7
Empty Response
OnGetResponse: id:7
Empty Response
Start Webrequest: id:8
OnGetRequestStream: id:13
Write Request:
<body xmlns="http://jabber.org/protocol/httpbind" rid="1096368631" key="ff09318993b82611feab1392849105b1834fc331" sid="296
00002541" to="xmpp-02.stentor.com" ><iq xmlns="jabber:client" id="agsXMPP_9" type="set" to="info-broker.XMPP-02.stentor.co
m"><pubsub xmlns="http://jabber.org/protocol/pubsub"><publish node="public/pubSubNode_1"><item><Content>633598610540966754
pub_1           2 generic message</Content></item></publish></pubsub></iq></body>
OnGetRequestStream: id:8
Write Request:
<body xmlns="http://jabber.org/protocol/httpbind" rid="857561528" key="7497f34cabae071866e0bec3913541efeeef4663" sid="2970
0003DAA" to="xmpp-02.stentor.com" />
OnEndWrite: id:13
OnEndWrite: id:8



this is how i initialized the XmppClientConnection
        private void InitializeAgsConnection(ref XmppClientConnection xcc, SocketConnectionType socketType, string userName, MessageHandler onMassageHandler)
        {
            xcc = new XmppClientConnection(socketType);

            xcc.Server = JID_SERVER;
           
            xcc.KeepAlive = true;
           
            xcc.UseSSL = false;
            xcc.UseStartTLS = true;
            xcc.AutoPresence = true;
            xcc.AutoRoster = false;

            if (socketType == SocketConnectionType.Direct)
            {
                xcc.Port = 5222;
            }
            else
            {
                xcc.Port = 7335;
                xcc.ClientSocket.Address = string.Format("http://{0}:{1}/{2}", JID_SERVER, xcc.Port, "httpbinding");
            }
           
            xcc.Username = userName;
            xcc.Resource = resourceSender;
            xcc.Password = userName;

            xcc.OnLogin += new ObjectHandler(xmppClientConn_OnLogin);
            xcc.OnMessage += onMassageHandler;
            xcc.OnWriteXml += new XmlHandler(xmppClientConn_OnWriteXml);
            xcc.OnReadXml += new XmlHandler(xmppClientConn_OnReadXml);
            xcc.OnStreamError += new XmppElementHandler(xmppClientConn_OnStreamError);
            xcc.OnError += new ErrorHandler(xmppClientConn_OnError);
        }
Avatar
Alex #2
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello iamdacian,

you are doing everything correct. Its my fault that the debug data is printed out to the console. I put it on my TODO list to remove the debug information.

The timed out WebRequests are a feature of BOSH, so don't care about them if everything works correct, I will also remove this debug information.

Is there a reason why you are switching to BOSH? There is much more overhead with BOSH. BOSH is ideal for WebClients written in JavaScript or similar technologies which have no access to sockets and can use only HTTP. And it works sometimes better in environments where you have no reliable TCP connection or switching networks very often.
If you are not on https your connection is also insecure.

Alex
Avatar
iamdacian #3
Member since Aug 2008 · 2 posts
Group memberships: Members
Show profile · Link to this post
hi alex, thank you for your answers. and i know the whole overhead of bosh and pitfalls, unfortunately bosh is a scenario that i have to support and make sure it's working.

now, what i am concerned about is that looking on how this small test is working with bosh is significantly different than the other way (direct socket) and i am referring to the bursts i am seeing, the app is timeout-ing for awhile and then it bursts in a few cycles and works again... this seem to be affecting the flow of the xmpp stream...
can you explain why these timeouts which seem to cause the bursting of the app...?
Avatar
Alex #4
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hi iamdacian,

normally HTTP is not asynchronous and realtime. To get an asynchronous realtime behavior BOSH is using the Comet technology with 2 or more open HTTP connections. This is described in detail in the BOSH XEP. These connections are HTTP requests and have a maximum keep alive time. When there are no stanzas available on the server for you then these requests time out with an empty response and the next request gets opened.

If you see other than these timeouts then there may be a problem. There are many different BOSH implementations in the servers, and some of them are not compliant with the latest specs, also the specs are still in development as you can see on very active discussions on the BOSH mailing lists. Which means it may be possible that there are problems with some of the available servers.

If you have lots of traffic over your xmpp connection you shouldn't use BOSH.

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: agsXMPP RSS