How to implement the "last seen" functionality (for example, whatsapp) in XMPP?

I am working on a chat application and want to add the "last seen" functionality. I am trying to implement it using existing stanzas, but getting one problem, please check the link below

Do not get inaccessible presence of user A when user B is also inaccessible

Is there any other way to implement the last seen in functionality

suggest

+4
source share
3 answers

Google "xmpp last seen" - XEP-0012: , , , .

:

<iq from='romeo@montague.net/orchard' 
    id='last1'
    to='juliet@capulet.com'
    type='get'>
  <query xmlns='jabber:iq:last'/>
</iq>

:

<iq from='juliet@capulet.com' 
    id='last1'
    to='romeo@montague.net/orchard'
    type='result'>
  <query xmlns='jabber:iq:last' seconds='903'/>
</iq>

, 903 . , " ".

+6

- .

- , , , , . .

0

@legoscia , ( , ), , https://github.com/processone/ejabberd/issues/2265

, , ( ) , "0".

One solution is to terminate the session each time the application is running in the background, and reconnect when the application is in the foreground.

-1
source

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


All Articles