Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Automatic reconnect and offline buffering implemented for JavaScript Client

Hi Mike,

I have used a proxy to sit between the client and the server in the past to simulate network outages.  There is one in the test material which I plan to use - https://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.testing.git/tree/interoperability/mqtt/proxy/mqttsas.py

This particular version breaks the connection when a particular combination of topic and payload is published through it

(packet.topicName == "MQTTSAS topic" and \ packet.data == "TERMINATE")

I've used different trigger events in the past too.

Ian

On 05/27/2016 05:06 PM, Mike Tran wrote:
Hi Ian,

I fixed maven build file to run existing jasmine _javascript_ tests awhile back,.  Currently, I run "mvn test" manually and the existing tests pass.  I am writing jasmine tests for the functionality that I just added.  The challenge is to simulate network outage to test automatic reconnect and offline buffering. If anyone knows how to do this within a test framework, please let me know.

I just looked at Travis-CI.  Travis-CI supports _javascript_ with node.js https://docs.travis-ci.com/user/languages/_javascript_-with-nodejs. I am not sure if we can use it for our _javascript_ client.

--
Regards,
Mike Tran
Phone: 512-286-8959 (T/L: 363-8959)
IBM Austin, Texas




From:        Ian Craggs <icraggs@xxxxxxxxxxxxxxxxxxxxxxx>
To:        paho-dev@xxxxxxxxxxx
Date:        05/27/2016 07:37 AM
Subject:        Re: [paho-dev] Automatic reconnect and offline buffering implemented for _javascript_ Client
Sent by:        paho-dev-bounces@xxxxxxxxxxx




Hi Mike,

that's great, thanks!  James and I will be taking a look at it soon.  Is there any progress on automated build and testing?  We're just starting to use Travis-CI for the Java and C clients.

Ian

On 05/26/2016 08:13 PM, Mike Tran wrote:
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
https://github.com/eclipse/paho.mqtt._javascript_/pull/72
 
The code is available here: https://github.com/miketran78727/paho.mqtt._javascript_
    (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
 




_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

--
Ian Craggs                          
icraggs@xxxxxxxxxx                IBM United Kingdom
Paho Project Lead; Committer on Mosquitto

_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev




_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

-- 
Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto


Back to the top