powered by Jive Software

How to send a keep-alive?

My XIFF client is getting logged out automatically due to no activity. What type of packet should I send for a keep-alive?

I have tried sending just a new Pesence(), but it seems that everytime I call send, it sends more and more packets. Ie, the first time it sends one. Then two. Then four. Then eight…

Anyone have a small code snippet they use for this?

Here is what I came up with:

public function keepAlive() {

if (connection.isLoggedIn()) {

var roster:Roster = new Roster(connection);

roster.setPresence(null, “Online”, 0);

}

}

setInterval(keepAlive, keepAliveIntervalMS);

You could alway set the timeout to -1 (no timeout).

If it doesn’'t exist, add this to the server system properties in the admin panel:

xmpp.client.idle

and give it a value of -1

Paul