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?