@reactoo/watchtogether-sdk-js 2.7.31 → 2.7.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.7.31",
3
+ "version": "2.7.32",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -142,8 +142,10 @@ class Iot {
142
142
  send(topic, message) {
143
143
  this.log('iot send', topic, message);
144
144
  let msg = typeof message === 'object' ? JSON.stringify(message) : message;
145
- if (this.connection) {
145
+ if (this.connection && this.connection.currentState === 0 && this.connection.desiredState === 0) {
146
146
  this.connection.publish(topic, msg, mqtt.QoS.AtLeastOnce, false);
147
+ } else {
148
+ throw new Error('Invalid topic or not connected:', topic);
147
149
  }
148
150
  }
149
151