Jabber-Net
Jabber-Net copied to clipboard
XEP-0199: XMPP Ping
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.
See also: http://stackoverflow.com/questions/23863703/how-to-send-ping-packets-using-jabber-net-library — Joe himself have answered a similar question.
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.
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).