Forced Presence Update for Detached XEP-0198 Sessions on Openfire

I am developing a Flutter chat application using Openfire (5.0.2) and the Smack library (via a xmpp_plugin(flutter)). I am facing an issue with “Ghost Connections” when users turn off mobile data manually.

The Scenario:

1.User B turns off mobile data (sudden socket break). 2.Openfire moves the session to “Detached” status (XEP-0198 Stream Management). 3.User A still sees User B as “Online” because the session is technically still held by the server for resumption. 4.User A sends a message and gets a single tick, User B turns on the mobile date again he gets that message delivered properly but i want change the presence of the user when he manually turns off the data.

What I have tried:

1.Reduced idle-seconds to 5s (This only affects the TCP socket, not the detached XMPP session). 2.Set sm.resumption.timeout to 10s (This eventually kills the session, but there is still a 10-15s “Ghost” window). 3.Calling logout() on the client side when connectivity changes to none (Often fails because the data is already gone).

Questions:

1.Is there a way to force Openfire to broadcast an Unavailable presence to other users the moment a session enters the “Detached” state, rather than waiting for the resumption timeout? 2.Is there a native Smack listener or server-side property that can differentiate between an “Active/Authenticated” session and a “Detached” session from a third-party user’s perspective?

The entire reason for having XEP-0198 is to have the server act as if the user was still connected, to overcome (brief) network interruptions. If that’s not what you want, then you should reconsider using Stream Management.

For the server, it’s next to impossible to determine if a TCP connection drops because of an unexpected network interruption, or because the user manually disabled their mobile data. Perhaps you can detect this client-side? If so, you could try and send an presence update just before the network disconnects (although I doubt that that’s possible, but I’m not an expert in mobile development).