Quantcast
Channel: Ignite Realtime : Unanswered Discussions - Support
Viewing all articles
Browse latest Browse all 4979

Smack API - client broken on timeout IQ result-error, how to avoid? (bookmarkManager involved)

$
0
0

Hello all,

I have developed a Spark-like client with Smack API (2.7.7) connected on Openfire 4.0.2.

 

My issue: when I use BookmarkManager to add a Bookmarks, sometimes I recive a timeout that litteraly broke the client.

 

 

Code:

BookmarkManager.getBookmarkManager(XmppManager.getInstance().getConnection()).ad dBookmarkedConference(mucSubject,

  mucRoom, true, myDisplayName,  password);

 

 

Timeout error:

(atm can't paste, but it's the common timeout error, timeout it's setted up as 50 seconds)

 

 

I don't know how to handle this timeout and ignore/do something else when occours.

For sure, what I get is that thread-sequence broke and client starts to have unpredictable behaviour.

 

 

Any idea and explanation?

 

 

I've found this code in Spark but I didn't really understaind how to use a PacketCollector, I'm pretty sure I miss something important (for custom IQ I just register a StanzaListener addAsyncStanzaListener); more, if no result, I'd like to continue with some other operations

 

 

        PacketCollector collector = con.createPacketCollector(new PacketIDFilter(registration.getPacketID()));

        con.sendPacket(registration);

        IQ response = (IQ)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());

        collector.cancel();

        if (response == null) {

            throw new XMPPException("Server timed out");

        }

        if (response.getType() == IQ.Type.ERROR) {

            throw new XMPPException("Error registering user", response.getError());

        }

 

 

More: bookmark are however "slow" compared to other actions, it's that normal?


Viewing all articles
Browse latest Browse all 4979

Trending Articles