Reduce PINGREQ frequency to KeepAliveInterval at a maximum

The Mqtt client was sending PINGREQ messages every KeepAliveInterval / 3
seconds, regardless of any client publish activity. The v3.1 spec states
that the server expects at least one message per KeepAlive interval and
allows a 50% grace period after that before the client is disconnected.

This patch reduces write actitivy so that a PINGREQ timer is reset on
PUBLISH, meaning a ping is only sent if a publish hasn't been sent in the
past KeepAliveInterval seconds.
Merge pull request #8 from CapnBry/master

 Reduce PINGREQ frequency to KeepAliveInterval at a maximum