XMPP How can I get a notification or event when the current user goes offline?

I applied a chat application using the XMPP iOS Framework with an OpenFire server.

I just need to get a notification or event when the current user disconnects from XMPP.

I implement the XMPPReconnectDelegate delegate and method

 - (void)xmppReconnect:(XMPPReconnect *)sender didDetectAccidentalDisconnect:(SCNetworkReachabilityFlags)connectionFlags 

But the problem is that it is not called in iOS 7.1 and works in iOS 8.

Is there any other method or delegate?

Thanks in advance.

+6
source share
2 answers

The following method will also call when the user disconnects from the XMPP server.

  • (void) xmppStreamDidDisconnect: (XMPPStream *) sender with an error Error: (NSError *) {

}

+1
source

Methods have been delegated to XMPP, and you can easily check to see if the user is going offline.

 - (void)xmppStreamDidDisconnect:(XMPPStream *)sender withError:(NSError *)error { if (!isXmppConnected) { NSLog(@"disconnect from XMPP"); } } 
0
source

Source: https://habr.com/ru/post/987182/


All Articles