adamvr/MQTT.js — pull request #77 by davedoesdev (2013-05-13 21:50:59+00:00)
Title: Clear ping timer and delay puback/pubcomp

Couple of things here:

1. Clear the ping timer on close (sometimes you can get a close without an error, e.g. if the server is restarted). I don't think this should be controversial.

2. When emitting 'message', pass a callback function which the event handler should call when it's done (the callback then does puback/pubcomp). This gives it the opportunity to do some asynchronous work before puback/pubcomp is done. For instance, I'm relaying messages to another message queue system and only want puback/pubcomp to be sent once that system has acked the message. I realise this changes the API; I wonder if there's a way to do this and keep compatibility with existing code?