简体   繁体   English

XMPP(SMACK API)如何保存登录会话?

[英]XMPP (SMACK API) how to save login session?

I am using Smack API to connect to the Openfire server from Android application. 我正在使用Smack API从Android应用程序连接到Openfire服务器。 At the first time I have successfully made it work to login user and send message to other user. 第一次,我成功地完成了登录用户并将消息发送给其他用户的工作。 But my problem is when i remove the app from the stack and try to connect with the server again then connection was established but it also requires login again to send or receive message. 但是我的问题是,当我从堆栈中删除该应用程序并尝试再次与服务器连接然后建立连接时,但它还需要再次登录才能发送或接收消息。 So how can i manage login session so that i don't need to login again? 那么我如何管理登录会话,这样我就不需要再次登录?

openfire by default remove the sessions of the idle clients. 默认情况下,openfire会删除空闲客户端的会话。 To achieve what you are asking, you have to overwrite xmpp.client.idle in your openfire to -1 to make your session continues. 为了实现您的要求,您必须在xmpp.client.idle覆盖为-1以使会话继续进行。

but i would recommend you otherwise because it may result in possible loss of message.but you can always increase your session time from default to your preference 但我建议您以其他方式使用,因为这可能会导致message丢失。但是,您始终可以将会话时间从默认设置更改为偏好设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM