knolleary/pubsubclient — pull request #29 by ennui2342 (2013-10-31 21:57:25+00:00)
Title: Added support for QOS1 for messages received from the server

As per the discussion on http://stackoverflow.com/questions/19697099/limiting-message-prefetching-with-arduino-mqtt-library

I have added the ability to request QOS1 for PUBLISH from the server to the client. ie the server will hold the message until it is ack'd by the client. This enables the server to maintain a backlog of messages in a queue by limiting the number of unack'd messages it is prepared to have outstanding (eg in RabbitMQ this is through the prefetch configuration setting).

Implementation: I have added an optional argument to subscribe which when set to 1 enables QOS1 for that subscription. As the user supplied callback is blocking, the library automatically ack's the message after the callback returns. In the future it may be desirable for the user to do this themselves as they may want to not ack in some failure modes, but this had the least impact on the API.

Note that this does not add QOS1 support for PUBLISH from the client to the server which would require the Arduino to store the messages until the server ack'd.