title: How to send ping using Eclipse Paho MQTT client?
body: <p>We've just started building our own push notification system (due to client's requirement) for Android and found Eclipse Paho (<a href="http://www.eclipse.org/paho/" rel="noreferrer">http://www.eclipse.org/paho/</a>). Needless to say, this project is really exciting.</p>
  
  <p>The problem with Android is, if the CPU is in sleep state, the MQTT client may not get the chance to send ping at its set interval. The workaround is using AlarmManager to wake it up and get the job done. The Android documentation says:</p>
  
  <blockquote>
    <p>The Alarm Manager holds a CPU wake lock as long as the alarm
    receiver's onReceive() method is executing. This guarantees that the
    phone will not sleep until you have finished handling the broadcast.
    Once onReceive() returns, the Alarm Manager releases this wake lock.
    This means that the phone will in some cases sleep as soon as your
    onReceive() method completes.</p>
  </blockquote>
  
  <p><a href="http://developer.android.com/reference/android/app/AlarmManager.html" rel="noreferrer">http://developer.android.com/reference/android/app/AlarmManager.html</a></p>
  
  <p>I need to be sure that I could send the ping command within that onReceive() method while the CPU has PARTIAL_WAKE_LOCK, so I was searching a way to manually sending ping to server but it seems the client doesn't expose any such method. Am I missing something? Or, what is the workaround here except publishing my own "ping message"? I want to avoid that because of:</p>
  
  <ol>
  <li>Larger overhead</li>
  <li>We'll ensure that Android clients are subscriber only, may be with Mosquitto's ACL. They will not be allowed to publish messages.</li>
  </ol>