powered by Jive Software

Reconnection issues with openfire

i am using openfire xmpp server and asmack library to implement pubub node , the biggest issue that i face is the reconnection problem to the xmpp server.

whenever a connection is made to the xmpp server there are lots of stanza is being exchanged possibly around 5 to 7 stanza in a desktop applicaiton or web application it seems ok , but for mobile application where 3G link is pretty weak , in that case it too good to exchange so much of stanza.

i have tested that when the wifi has a weak signal or 3g link is down , i am making a reconnecting to the server (in background process) but i mostly get a response time out error and taking too much time if the connection gets successful.

i have seen messenger like whatsapp in which they are making a reconnection pretty fast. i want to do something like that only.

i have read about the pre-http binding but its exist in ejabber but didnt find anything in openfire moreover htt-prebinding is for anonymous users and i am using registered users only.

so can anyone tell me how can i reconnect fast to the xmpp server.

while exploring i saw xmpp protocol XEP 0198 to resume the streaming session but it seems openfire doesnt support this so can anyone tell me what is the better and faster way to reconnect to the openfire server when network link goes down


Develop your own plugin and handle the connection using a mobile friendly protocol like mqtt (like facebook messenger). The plugin can reuse Openfire session objects for your users. For ideas, see the Websockets plugin I developed for Openfire.

How i am gonna integrate mqtt in openfire ? can you provide me any rode map ?

i can develop a plugin but not sure how to embed mqtt in it


I am planning on developing a MQTT plugin using it.

Nice , but i need some solution in my current project , so how about this approch

intercept the current session inside a plugin and resume the session when the network links goes up in mobile phone ?

this is just a guess as the in my case i am using only registred user in openfire. so is that possible to resume the authenticated user session ?

as i have read your code for websocket plugin and in XMPPServlet i found

session = (LocalClientSession) SessionManager.getInstance().getSession(new JID(JID.escapeNode(username) + “@” + JiveGlobals.getProperty(“xmpp.domain”) + “/” + resource));

if (session != null)



session = SessionManager.getInstance().createClientSession( wsConnection, new BasicStreamID(“url” + System.currentTimeMillis() ) );

wsConnection.setRouter( new SessionPacketRouter( session ) );

authToken = new AuthToken(username);


do you solve you problem.I am also facing same problem.