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", 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

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 @@ - +
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 }); } }); }, 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); }