From e4446b894403d877bd8ca6bc1f4f767dfbaaaf3d Mon Sep 17 00:00:00 2001 From: fablec Date: Wed, 18 Jan 2017 17:06:09 +0100 Subject: [PATCH 1/5] on disconnect, set connected to false --- tsante-mqtt.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsante-mqtt.html b/tsante-mqtt.html index 57c9207..c60faff 100644 --- a/tsante-mqtt.html +++ b/tsante-mqtt.html @@ -127,7 +127,7 @@ ], _initializeClient: function(host,clientID) { - if(this.connected && this.client) { this.disconnect(); } + if(this.connected && this.client) { this.disconnect(); } this.client = new Paho.MQTT.Client(this.host, this.clientID); this.client.onConnectionLost = this._onConnectionLost.bind(this); this.client.onMessageArrived = this._onMessageArrived.bind(this); @@ -239,6 +239,7 @@ disconnect: function() { try { this.client.disconnect(); + this._setConnected(false); } catch(err) { this._onError(err.message); } From 46ec4cec4fc55519beff4728e843cd5749a486c0 Mon Sep 17 00:00:00 2001 From: fablec Date: Wed, 18 Jan 2017 17:07:49 +0100 Subject: [PATCH 2/5] subscriber : when parent disconnected send the unsubscribe event --- tsante-mqtt-subscriber.html | 1 + 1 file changed, 1 insertion(+) diff --git a/tsante-mqtt-subscriber.html b/tsante-mqtt-subscriber.html index d2ad8b6..61ab950 100644 --- a/tsante-mqtt-subscriber.html +++ b/tsante-mqtt-subscriber.html @@ -54,6 +54,7 @@ this._subscribe(); } else if(this.subscribed) { this._setSubscribed(false); + this.fire('tsante-mqtt-subscribed', { topic: this.topic, status: false }); } }); }, From 79a8d5bdababa614f8414d0f4aec433e8f862905 Mon Sep 17 00:00:00 2001 From: fablec Date: Wed, 18 Jan 2017 17:08:17 +0100 Subject: [PATCH 3/5] A first set of tests --- test/tsante-mqtt_test.html | 145 ++++++++++++++++++++++++++++++++++++- 1 file changed, 143 insertions(+), 2 deletions(-) diff --git a/test/tsante-mqtt_test.html b/test/tsante-mqtt_test.html index 1937337..53abb52 100644 --- a/test/tsante-mqtt_test.html +++ b/test/tsante-mqtt_test.html @@ -14,16 +14,157 @@ - +
From 8f20bf562f1d8ef80fffd6ebd1845ab5471eebee Mon Sep 17 00:00:00 2001 From: fablec Date: Wed, 18 Jan 2017 17:35:56 +0100 Subject: [PATCH 4/5] demo : add note --- demo/index.html | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/demo/index.html b/demo/index.html index bb15621..921e2c1 100644 --- a/demo/index.html +++ b/demo/index.html @@ -16,9 +16,37 @@ .vertical-section-container { max-width:80%; } + .note { + max-width:80%; + margin:auto; + background: rgb(251, 243, 178); + border:1px solid black; + padding: 10px; + text-align: justify; + } + .note button { + font: inherit; + font-size: 16px; + padding: 10px 20px; + color: white; + background: dodgerblue; + border: none; + border-radius: 5px; + margin:auto; + } +
+

The demo uses the test mqtt server provided by mosquitto.org.

+

This server uses self-signed certificates, you must accept the + certificate to run the demo. To do so, go to + https://test.mosquitto.org:8081/ + and accept the certificate. Then reload the demo page.

+
+ +
+

Subscribe demo

From 59c2d813f79523aff695560fe855a18194d56cfd Mon Sep 17 00:00:00 2001 From: fablec Date: Wed, 18 Jan 2017 17:44:35 +0100 Subject: [PATCH 5/5] bump version 1.0.1 --- CHANGELOG.md | 10 ++++++++++ bower.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..449e60d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ + +# v1.0.1 + + - tsante-mqtt : reinitialize client when modifying host or clientID + - tsante-mqtt : on disconnect set connected to false + - tsante-mqtt-subscriber : when tsante-mqtt disconnect, unsubscribe the topic. + +# v1.0.0 + +First public release diff --git a/bower.json b/bower.json index 18a9e81..e5065d3 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "tsante-mqtt", - "version":"1.0.0", + "version":"1.0.1", "description": "A MQTT component", "license": "LICENSE.md", "main": "tsante-mqtt.html",