Thats exactly what I needed but I thought that Smack has support for it. Can you please explain what
ProxyInfo.forHttpProxy(host, port, user, pass) method exactly do? Actually my objective is to run the jabberd server behind firewall listening on port 80 so the client can make a connection via http.
BOSHConnection.java and BOSHPacketReader.java are not compiling. Can you please help me with the build.
The respective error is Connection and BOSHClientResponseListener cannot be resolved to a type.
Thanks
Edited:
Hey, I resolved the build problem (I didnt checked out entire project earlier) .
Now the code
BOSHConfiguration config = new BOSHConfiguration(false, “host”, 80, “/http-bind”, “domain”);
Connection conn = new BOSHConnection(config);
conn.connect();
is working perfectly but I am getting an exception while I try to disconnect() the connection.
I also checked out the three java files but I am having problem to build it. The classes
Exception in thread “BOSHClient[26315233]: Receive thread” java.lang.NullPointerException
at com.kenai.jbosh.XLightWebResponse.awaitResponse(XLightWebResponse.java:187)
at com.kenai.jbosh.XLightWebResponse.getBody(XLightWebResponse.java:166)
at com.kenai.jbosh.BOSHClient.processExchange(BOSHClient.java:1031)
at com.kenai.jbosh.BOSHClient.processMessages(BOSHClient.java:976)
at com.kenai.jbosh.BOSHClient.access$000(BOSHClient.java:97)
at com.kenai.jbosh.BOSHClient$1.run(BOSHClient.java:215)
at java.lang.Thread.run(Thread.java:619)
Thanx for the info. I have been able to connect to Openfire using the development build using BOSH.
I am trying to pass the connection RID and SessionID after creation to the Browser, so that Strophe can reattach itself to the already created connection.
I modified the com.kenai.jbosh and your library and added a function to return back the RID from the connection.
My problem is that Strophe is not been able to bind itself to the created connection.
While searching I came across this which uses Mod-Http-Pre-Bind
for ejabbered. My question now is “Does Openfire supports Http-pre-binding”. If yes how may I use it?
Openfire officially supports attaching to existing sessions (so it should also work with prebinding). Some time ago, I tried to use openfire with StropheJS, too but it just won’t work. I figured out that it sometimes helped to increase the rid when attaching to a session but somehow that spawned new problems and I never got this working 100% with openfire. I guess that the BOSH implementation of openfire is a bit buggy or at least very strict when it comes to managing rid’s.
In the end my solution was switching to ejabberd which works like a charm.
would you be so kind as to post the details on how you modified the code to return the RID? I am facing the same situation at the moment and I would like to try my hand at getting Strophe to successfully attach to a session. Thanks!
Big thanks to Guenther for sharing the smack-bosh code. Its working well for me so far. I just need that RID now!
I must be missing something. I don’t see a function called getRid() anywhere in the smack-bosh or jbosh source, and my build expectedly fails when I add the function suggested above. You mentioned making a modification to jbosh as well - were you talking about the referenced getRid() function? That’s the part that would be most useful to me, I would greatly appreciate it if you could share that too
i had some time yesterday to make those edits and rebuild the .jars. thanks again vibhu - your edits worked nicely. i was able to start a BOSH connection with smack with no problems. now i’m having an odd issue attaching the connection with strophe - it always works in firefox, sometimes in safari, and never in chrome. weird! i guess i’m to find some strophe support for that one now.
have done a backport of the bosh client to smack 310, attaching as a zip file. The main part was to make BoshConnection extend XMPPConnection, handle IQ s in a better way. The only non BOSH class I needed was org.jivesoftware.smack.sasl.SASLMechanism from the latest branch. smack-bosh-backport.jar (8473 Bytes)
I was looking into your work in the bosh branch. Can you tell me which version of smack the BOSH version is built against? I noticed that when I built the library from source in shows ‘smack-bosh-3.2.0’. Does this mean that it is built against the 3.2.0 release of smack? Also, is there any idea if this branch will become part of the release so that bugs will be fixed against it?
This jar is having BOSHClient.java which calls “XmlPullParserFactory,java” at runtime which doesn’t exist in latest 3.2.1 smack release. So, I end up with following exception:
Exception in thread “BOSHClient[1762502123]: Receive thread” java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserFactory
Can someone please help me in understanding the build structure becuase structure of BOSH branch is different than TAG/Trunk.
Version : Openfire 3.7.1 , Smack- 3.2.1 and jbosh-0.6.0.jar
XMPP default port: 5222 and my connection manager port: 5333 and HttpBinding – 7070(Enabled in Admin console)
BOSHConfiguration config = new BOSHConfiguration(false, “myipaddress”,
5222, “/http-bind”, “myservicename”);
I made those changes in BOSHClient.java and after that also I am getting the same errors.
If I use the port number as 5222 / 5333 I am getting Timeout reaches Exception
And for 7070 port I am getting NullPointerException
Exception in thread “BOSHClient[18378667]: Receive thread” java.lang.NullPointerException
at com.kenai.jbosh.XLightWebResponse.awaitResponse(XLightWebResponse.java:187)
at com.kenai.jbosh.XLightWebResponse.getBody(XLightWebResponse.java:166)
at com.kenai.jbosh.BOSHClient.processExchange(BOSHClient.java:1031)
at com.kenai.jbosh.BOSHClient.processMessages(BOSHClient.java:976)
at com.kenai.jbosh.BOSHClient.access$000(BOSHClient.java:97)
at com.kenai.jbosh.BOSHClient$1.run(BOSHClient.java:215)
at java.lang.Thread.run(Unknown Source)
I am bit confusing with these port number. Actually which port number do I need to use here.
I am using these jars [ smack.jar,smackx-debug.jar,smackx-jingle.jar, smackx.jar, xlightweb-2.5.jar, xmlpull_1_1_3_4c.jar, xpp3-1.1.4c.jar, xSocket-2.6.6.jar and dom4j-1.6.1.jar]
Can someone please help me whatelse jars do need to include or post here the modified jars…
Exception in thread “BOSHClient[32389396]: Receive thread” java.lang.NullPointerException
at com.kenai.jbosh.XLightWebResponse.awaitResponse(XLightWebResponse.java:188)
at com.kenai.jbosh.XLightWebResponse.getBody(XLightWebResponse.java:166)
at com.kenai.jbosh.BOSHClient.processExchange(BOSHClient.java:1056)
at com.kenai.jbosh.BOSHClient.processMessages(BOSHClient.java:1000)
at com.kenai.jbosh.BOSHClient.access$0(BOSHClient.java:970)
at com.kenai.jbosh.BOSHClient$1.run(BOSHClient.java:211)
at java.lang.Thread.run(Unknown Source)