Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

Ping isn't working properly when connection goes down

$
0
0

I have used the PingManager to implement the XEP-0199: XMPP Ping – sever to client ping.

But the issue with this approach is  when the wifi is ON but the network link is down , I am not getting a ping from a server and not even my PingFailed listener is getting fired.

 

So how can I check connection is alive because sometimes isConnection and isAuthentication returns true itself , even if the session is not closed at server. so if pingFailed funcitons works or is there any function exist were i can  hook up in coming packet and check with the outgoing ping then in that case i  can create a new xmpp connection to server and give seemless experience to the user

 

here is my code.

 

public void InitializePingManager(){

 

                    mPingManager = PingManager.getInstanceFor(xmpp);

                    mPingManager.setDefaultPingInterval(1000*50);

                    mPingManager.setPingInterval(1000*50);

                    mPingManager.registerPingFailedListener(new PingFailedListener(){

 

 

                              @Override

                              public void pingFailed() {

                                        // TODO Auto-generated method stub

 

                                        Log.e("PING" , "ping failed");

                              }

 

 

 

                    });


Viewing all articles
Browse latest Browse all 10742

Trending Articles