Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
Babu #1
Member since Apr 2016 · 7 posts
Group memberships: Members
Show profile · Link to this post
Subject: User Connect & Reconnect Problem
Dear All,

When the user is disconnected at client due to some connectivity problem, the user is shown as online in ejabberd server. Due to this, I could not reconnect when the connection is established.

Even If I try to send message without reconnection, I am getting " Unable to send data. The XMPP Stream is inactive " as Login error.

Please help me to solve this problem.

Thanks & Regards
Babu
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
when you connection drops you should get an OnClose event in MatriX.
Bases on this event I suggest that you add your reconnect logic based on a timer with an increasing interval.

In some cases it can take a while until the server or the client detect the connection loss.Sending KeepAlives and Regular XMPP Pings help to detect connection loss faster.
Avatar
Babu #3
Member since Apr 2016 · 7 posts
Group memberships: Members
Show profile · Link to this post
HI Alex,

Appreciate your immediate response.  :-)

I will check as per your suggestions and get back to you.

Thank You.
Regards
A.Babu
Avatar
Babu #4
Member since Apr 2016 · 7 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

I tried your suggestion. The OnClose event is fired, when the connection drops.

But the user is online in the server.

I use the NetworkChange.NetworkAvailabilityChanged event to track the reconnection. Here I wrote the reconnection logic. But XMPPclient.Open() fails and triggers XMPPClient.Error event ( Even I Close the XMPPClient on reconnection also).

Also please clarify how to send - KeepAlives and Regular XMPP Pings and when to send.

Thanks & Regards
Babu
Avatar
Alex #5
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
It can take a while for the server to detect the loss.
You can check with your server vendor if you can configure and enable keep alive and pings.

Matrix has a keep alive property where you can configure the interval for them.
For pings just use the PingIq class, send them to the server and wait for the reply.

As said before, often you can detect socket loss only when you try to send data. Connections can broken only in one direction, this is where a Ping helps.
Avatar
Babu #6
Member since Apr 2016 · 7 posts
Group memberships: Members
Show profile · Link to this post
HI Alex,

I am using the matrix C# library to connect to ejabberd server.

This disconnection problem prevails only in DeskTop application.

From the Android Mobile app, the server connection closes in the specified timeout period (using configuration resume_timeout), but does not happen in DeskTop application.

Please help me out

Thanks
Babu
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: