Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsPaho Java client, turning off automatic ping messages
https://www.eclipse.org/forums/index.php/mv/msg/390596/930282/#msg_930282
Im currently working on an android mqtt based app using the paho java client. Here is my Question:
Is there a qay to turn of the automatically created ping messages that the client sends the broker every "keepAliveInterval" seconds?
Since the CPU of my device can go to sleep every now and then i need to implement my own ping service, wich wakes the CPU when its time to ping. The "problem" is that now i ping twice when the cpu is running.It would be nice to have an option in the ConnectionOptions to tell the client that i gonna do the pinging stuff on my own.
kind regards!
Tobi]]>tobi hofer2012-10-02T07:08:12-00:00Re: Paho Java client, turning off automatic ping messages
https://www.eclipse.org/forums/index.php/mv/msg/390596/930593/#msg_930593
If any MQTT packet (not just ping) is sent within a keepalive interval the MQTT client will reset the timer which it uses to send a ping i.e. it minimises when it sends pings to only when no MQTT packet has been sent within a keepalive interval.
How are you sending a ping at the moment? The MQTT client does not have a public interface for sending a ping?
If a ping method was added then I believe the following would provide what you are looking for?
1) MQTT app sets the keepalive to value x
2) MQTT app has logic to wake up slightly less than x
3) MQTT app invokes the MQTT ping - this would reset the internal keepalive timer in the client meaning it would then not send its own ping.
Until a ping method is added publishing a message or re-subscribing would have the same effect.
]]>Dave Locke2012-10-02T13:10:16-00:00Re: Paho Java client, turning off automatic ping messages
https://www.eclipse.org/forums/index.php/mv/msg/390596/932693/#msg_932693
I didnt know that the client stops pinging if any message was sent to the server within the last keepAlive period.
The problem was that my self managed ping message was sent shortly after the ping from the client. so it was a little too late. I changed the ping period that my app pings shortly before the mqtt client and that solved the problem.
thanks for your advice!]]>tobi hofer2012-10-04T10:37:50-00:00