Prebind not working due to RID

Hello,

I have searched for similar issues/questions here but haven’t found anything.

I am using Java babbler to sign a user in to the openfire server and retrieve the RID and SID, using BOSH.

I then pass these values to the front end Converse.js client to use the started session. At this point I would have thought that I need to increment the RID by one and use that, if I do that I get a message like this in the openfire logs

2015.05.13 08:53:18 org.jivesoftware.openfire.http.HttpSession - Request 1389515084177898 > 1389515084177897, ending session.

and the user is disconnected.

If I leave the RID as is and do not increment it I can see that the user is connected though in the next request to the server (converse.js increments the RID as it should) and I see the openfire log message again ie

2015.05.13 08:53:18 org.jivesoftware.openfire.http.HttpSession - Request 1389515084177898 > 1389515084177897, ending session.

and the user is disconnected again. I am not sure why openfire is not allowing the rid to be incremented.

If I log the user in direct from the converse.js client ie there is no prebind then everything works as it should.

Can anyone shed any light on this? All help appreciated.

Thanks,

Robert

Strange. I just tried using the RID from the java code and subtracted 1 from that. This works, which seems strange to me. I have confirmed that the RID returned from the java code is used for the last request.

Can anyone explain this?

Hi Robert,

I’m currently going through the same process you are, setting up BOSH http-prebinding for a library similar to converse.js. Unfortunately I’m not able to answer your question, but I was wondering if you might be able to provide a snippet of the smack code you’re working with to generate the RID/SID and provide them to users?

Thanks,

Michel.

Here is a my test code to get the RID/SID, it is just set up for test and debug purposes but it gets the info I need.

BoshConnectionConfiguration boshConfiguration = BoshConnectionConfiguration.builder()

.hostname(“host”)

.port(7070)

.file("/http-bind/")

.wait(6) // BOSH connection manager should wait maximal 60 seconds before responding to a request.

.build();

XmppSession xmppSession = new XmppSession(“domain”, boshConfiguration);

try {

xmppSession.connect();

} catch (XmppException ex) {

ex.printStackTrace();

}

System.out.println(“RID=”+((BoshConnection)xmppSession.getActiveConnection()).g etRequestId().toString());

try {

xmppSession.login(“test”, “test”, “”);

} catch (Exception ex) {

ex.printStackTrace();

}

System.out.println(“RID=”+((BoshConnection)xmppSession.getActiveConnection()).g etRequestId().toString());

String sessionId = “”;

String requestId = “”;

BoshConnection bconn = ((BoshConnection)xmppSession.getActiveConnection());

sessionId = bconn.getSessionId();

requestId = “”+bconn.detach();

//requestId = bconn.getRequestId().toString();

System.out.println(“RID=”+((BoshConnection)xmppSession.getActiveConnection()).g etRequestId().toString());

System.out.println("JID = “+xmppSession.getConnectedResource()+” : SID = “+sessionId+” : RID = "+requestId);

1 Like