我正在开发一个聊天应用程序,并希望添加“上次查看时间”功能。我正在尝试使用存在节来实现它,但遇到一个问题,请检查下面的链接
当用户 B 也不可用时,未获取用户 A 的不可用状态 https://stackoverflow.com/questions/24446717/not-getting-unavailable-presence-of-user-a-when-user-b-is-also-unavailable?noredirect=1#comment37832724_24446717
有没有其他方法来实现上次看到的功能
请建议
“xmpp 最后出现”的第一个 Google 结果是XEP-0012:最后活动 http://www.xmpp.org/extensions/xep-0012.html,这是一个协议扩展,可用于查找用户上次在线的时间。
您发送这样的请求:
<iq from='[email protected] /cdn-cgi/l/email-protection/orchard'
id='last1'
to='[email protected] /cdn-cgi/l/email-protection'
type='get'>
<query xmlns='jabber:iq:last'/>
</iq>
并得到这样的响应:
<iq from='[email protected] /cdn-cgi/l/email-protection'
id='last1'
to='[email protected] /cdn-cgi/l/email-protection/orchard'
type='result'>
<query xmlns='jabber:iq:last' seconds='903'/>
</iq>
这意味着该联系人最后一次在线是在 903 秒前。从当前时间中减去该时间即可得到“上次查看”时间戳。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)