尽管用户未连接到服务器,但用户仍然在线。并无法重新连接到服务器 [英] User is still Online although user is not connected to the server. And failed to reconnecting to the server

查看:82
本文介绍了尽管用户未连接到服务器,但用户仍然在线。并无法重新连接到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在聊天应用程序中使用smack客户端。一切都会好起来的,但是当由于某种原因连接中断时,我的服务器正在为该用户JID在线显示。

I am using smack client in my chat application. Everything is going to be fine but when connection aborted for some reason, my server is showing online for that user JID.

我的问题是断开连接后如何重新连接到服务器。我可以在服务线程中使用connection.isAuthenticated()方法捕获连接。但是无法重新连接到服务器。

My problem is that how to reconnect to the server again after disconnecting. I am able to catch for connection using connection.isAuthenticated() method in my service thread. But unable to reconnect to the server.

推荐答案

您可以在服务器端(ejabberd)启用mod_ping模块,以解决客户端出现的在线问题断开连接,但仍在线显示。这与TCP / IP的工作方式有关,并不特定于ejabberd。通常,将Linux配置为在2个小时左右后检测连接丢失,然后客户端使用ReconnectionManager将应用程序重新连接到ejabberd服务器,或者您可以定义自己的处理程序以跟踪活动连接(如果未连接到服务器则可以再次连接)。 mod_ping在此处检查- https://docs.ejabberd.im/admin/configuration/#modping

you can enable mod_ping module on server side (ejabberd) to overcome online issue if client disconnect but still show online. This is related to how TCP/IP works and is not specific to ejabberd. Generally, Linux is configured to detect connection loss after something like 2 hours and client side use ReconnectionManager to reconnecting app to ejabberd server or you can define your own handler to track active connection if not connected to server you can connect it again.How to enable mod_ping check here - https://docs.ejabberd.im/admin/configuration/#modping

这篇关于尽管用户未连接到服务器,但用户仍然在线。并无法重新连接到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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