Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Nicker #1
Member since Feb 2016 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: Feature request: extend keep alive to sustain a persistent connection
The goal is ensure the integrity of message delivery and to be able to sustain a 24/7 connection.

Client may disconnect due to network errors, in this case sending and receiving messages will cease to work.
due to that, messages may get lost.

The idea is to extend the keep alive in a way that when the client is disconnected, the keep alive timer will try to establish a connection till it succeeds.

I see two required immediate changes:

1. Being able to distinguish between a network disconnect due to network error and when the user explicitly requests to disconnect.
2. Adding every message to the message queue, and dequeuing a message only on a successful delivery.

Please add your comments / suggestions...
Alex #2
Member since Feb 2003 · 4434 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You can easily handle this on your own. There is no automatic reconnect in agsXMPP.
Just watch the OnErrors and OnClose events and reopen you connection on loss.
Whenever you loose your connection this results in a OnClose event.

The keep alive timer is not directly related to this. There are routers and network components which kill your connection if they see no traffic on it. The only purpose of the keep alive timer is to prevent this by sending 1 Byte on ever interval.
And it of course also help top detect connection losses. With sockets sometimes you can detect the loss of a connection only when you try to send a packet on the socket. Sending the byte will then also detect a broken connection and raise the OnClose event.

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:
Forum: agsXMPP RSS