5

We are using XMPPFramework & Openfire(Version: 4.6.2) for our application.

After killing the application or putting it into background mode, it still shows that the user online for few minutes, then after it became offline.

We have tried with Idle Connections Policy time but still got nothing.

Suggestions will be welcomed.

Rahul Patel
  • 534
  • 4
  • 17

1 Answers1

4

I have faced similar issue in a project and after investigation it was found that it happens when using Stream Resumption feature (Stream Management XEP-0198).

If stream resumption is enabled when starting a new stream, Openfire will not immediately mark the user as Offline, instead it's session will be marked in Detached state. So the client app can resume the stream again without having to do full login.

If you will not use Stream Resumption, user will immediately become offline.

When enabling Stream Management, if client sends following packet, resumption feature is enabled on the stream.

<enable xmlns='urn:xmpp:sm:3' resume='true'/>

For this packet, server acknowledges by sending back:

<enabled xmlns='urn:xmpp:sm:3' id='some-long-sm-id' resume='true'/>
  • This is exactly right. Also, this is a feature, not a bug. It is intended to allow clients to recover from brief network interruptions. Note that clients that 'suffer' from this have explicitly negotiated the use of this feature. – Guus Jul 27 '21 at 12:21
  • Yes this is a feature. But not sure if mobile applications can use it. Because when mobile application will launch again from killed state, every time normal login flow will execute. – Shoaib Ahmad Gondal Jul 29 '21 at 11:35
  • Network interruptions and killed applications are two very different scenarios. – Guus Jul 29 '21 at 16:04