Hi Experts,
Problem I am using Ejabberd ejabberd-19.09.1-windows. The issue i am facing is when i turn off the wifi and check ejabberd users list through administrator dashboard. The user status remain Online.
Required Guide/Solution I want that Ejabberd should mark the user status Offline as soon as the TCP connection is broken with XMPP. This could be either implicitly by closing XMPP connection or explicitly due to network disconnection
Mechanism that i am using in C#
public static void Main(){
XmppClientConnection xmpp = new XmppClientConnection();
xmpp.ConnectServer = "serveripaddress";
xmpp.Server = "localhost";
xmpp.Port = "5222";
xmpp.Username = "userid";
xmpp.Password = "userpassword";
xmpp.KeepAlive = true;
xmpp.AutoResolveConnectServer = false;
xmpp.AutoRoster = false;
xmpp.UseStartTLS = false;
xmpp.AutoAgents = false;
xmpp.UseSSL = false;
try
{
xmpp.Open();
xmpp.OnSaslStart += new agsXMPP.Sasl.SaslEventHandler(OnSaslStart);
xmpp.OnLogin += new ObjectHandler(Xmpp_OnLogin);
}
catch (Exception ex)
{
}
Thread.Sleep(500);
if (xmpp.XmppConnectionState == XmppConnectionState.SessionStarted || xmpp.XmppConnectionState == XmppConnectionState.Authenticated)
{
//success
}
else
{
//failed
}
}
private void OnSaslStart(object sender, SaslEventArgs args)
{
args.Mechanism = agsXMPP.protocol.sasl.Mechanism.GetMechanismName(MechanismType.PLAIN);
args.Auto = false;
}
private void Xmpp_OnLogin(object sender)
{
var xmpp = (XmppClientConnection)sender;
agsXMPP.protocol.client.Presence p = new agsXMPP.protocol.client.Presence(ShowType.chat, "Online");
p.Type = PresenceType.available;
xmpp.Send(p);
xmpp.OnPresence += new agsXMPP.protocol.client.PresenceHandler((s, pres) => xmpp_OnPresence(xmpp, pres, xmpp.Username));
}
I couldn't identify that, do i need to make changes to XmppClientConnection or on Ejabberd yml(configuration) file.
What i have attempted in ejabberd.yml
mod_ping:
send_pings: true
ping_interval: 120
ping_ack_timeout: 60
timeout_action: kill
mod_push_keepalive:
#resume_timeout: 60
But both of above mentioned mods forcefully destroy the connection even if the user is idle and online after specified interval, whereas i need to destroy connection only if user is offline not on idle state
Your help is much appreciated