Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XEP-0199: XMPP Ping #80

Open
ForNeVeR opened this issue Jan 18, 2017 · 3 comments
Open

XEP-0199: XMPP Ping #80

ForNeVeR opened this issue Jan 18, 2017 · 3 comments

Comments

@ForNeVeR
Copy link
Member

Add support for XEP-0199: XMPP Ping. If the server couldn't answer ping for some specified amount of time, disconnect from the server and ensure client gets notified.

@ForNeVeR
Copy link
Member Author

See also: http://stackoverflow.com/questions/23863703/how-to-send-ping-packets-using-jabber-net-library — Joe himself have answered a similar question.

@toledomatias
Copy link

Thank you for the references. I know only the basics of the XMPP protocol, I'm trying to learn it. How can I use the PingQuery class of the stackoverflow answer to send a ping to the server and then receiving it? I googled it without any success.

@ForNeVeR
Copy link
Member Author

ForNeVeR commented Jan 19, 2017

Sorry, it's been long since I last used IQ sending, but I'll try to help. Look: JabberClient is derived from XmppStream that has a Tracker property.

I believe that the main usage pattern looks like that:

client.Tracker.BeginIQ(new PingIQ(client.Document), (sender, iq, data) => {
    /* handle ping response */
}, null);

You could call it periodically and reconnect if the answer from the server wasn't received for some timeout.

On how to construct PingIQ type (Joe donesn't mention that), please consult AuthIQ class. It seems that you should create a type derived from generic jabber.protocol.client.TypedIQ<PingQuery> (where PingQuery is a type from Joe's example).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants