Hi all,
I have completed the development and manual testing of automatic reconnect and offline buffering for _javascript_ client. You can see the summary of changes on github under this pull request
(src/mqttws31.js)
To enable offline buffering, set disconnectedPublishing = true. Default offline buffer size is 5000, it can be set via disconnectedBufferSize property. Here is an example:
var client = new Paho.MQTT.Client(server, port, clientId);
client._onConnected_ = onConnected;
client._onConnectionLost_ = onConnectionLost;
client._onMessageArrived_ = onMessageArrived;
client._onMessageDelivered_ = onMessageDelivered;
client.disconnectedPublishing = true;
client.disconnectedBufferSize = 100;
To enable automatic reconnect, set reconnect option to true, e.g.:
client.connect(
{cleanSession : false,
onSuccess : onConnectSuccess,
onFailure : onFailedConnect,
keepAliveInterval : 10,
reconnect : true});
I have manually tested the code and I have not found any regression. I would appreciate additional testing and feedback.
--
Regards,
Mike Tran