为什么在会话中不存在会话的情况下,openfire用户仍保持在线状态 [英] Why the openfire's user remains ONLINE even with no SESSION exists in sessions

查看:307
本文介绍了为什么在会话中不存在会话的情况下,openfire用户仍保持在线状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发使用OpenFire作为XMPP服务器并使用Smack for android客户端的包含消息"的android应用. 所有功能都可以正常工作,但是当用户在线时(如您在openfire的管理面板中看到的状态),并且网络连接突然断开,它的会话将被破坏,但用户仍在服务器中处于联机状态!因此,数据包不会作为脱机消息存储在服务器中,即使用户处于脱机状态,也会将其发送给用户,并且数据包将会丢失! 我已经测试过Windows客户端(Spark),但是当它的连接断开时,服务器中的会话将被破坏,用户会立即变为OFFLINE! 我该怎么做才能解决这个问题?

I'm developing an android app contains "Messaging" using OpenFire as an XMPP server and using Smack for android client. All functions works fine, but when a user is online(as you can see it's state in admin panel of openfire), and network connectivity disconnected suddenly, the session of it will be destroyed, but the user remains ONLINE in server! Thus, the packets not stores in server as an offline messages and will be sent to user even the user is offline and packets will be lost! I was tested an windows client (Spark), but when its connectivity losing, session in server will be destroyed and the user immediately turns to OFFLINE! What can I do to solve this problem?

推荐答案

此行为可能是由名为流管理.

This behavior is likely introduced by an XMPP feature called Stream Management.

简而言之,此功能允许短暂断开连接的客户端从上次中断的地方接机,而无需执行与正常连接(往往会涉及大量资源)相关的所有操作.

In short, this feature allows for clients that briefly disconnect to pick up where they left off, without doing all of the things associated with a normal connect (which tends to involve a lot of resources).

这对于网络连接不灵通的客户端或在将应用程序置于后台(例如在手机上)时会中断连接的设备很有用.

This is useful for clients with spotty network connectivity, or devices that kill connections when putting an application to the background, like on mobile phones.

Openfire实现此功能.请注意,数据包不会像您描述的那样丢失".相反,所有未处理的数据包都将被缓冲,并且,当客户端迟到"重新连接时(适用超时,我认为默认值为3分钟),这些数据包将被视为已发送给断开连接的数据包.设备.

Openfire implements this functionality. Note that packets are not 'lost', as you describe. Instead, all of the unhandled packets will be buffered, and, when the client is 'to late' to reconnect (a timeout applies, I think the default is 3 minutes), those packets will be treated as if they were sent to a disconnected device.

如果需要,可以通过将'stream.management.active'属性设置为'false'来禁用此功能(但是对于典型的设置,您不希望这样做,因为Stream Management功能具有很好的用途)

If you want, you can disable this feature by setting the 'stream.management.active' property to 'false' (but for typical setups, you don't want this, as the Stream Management functionality serves a good purpose).

这篇关于为什么在会话中不存在会话的情况下,openfire用户仍保持在线状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆