@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.
@@ -25315,8 +25315,10 @@ class Iot {
25315
25315
  send(topic, message) {
25316
25316
  this.log('iot send', topic, message);
25317
25317
  let msg = typeof message === 'object' ? JSON.stringify(message) : message;
25318
- if (this.connection) {
25318
+ if (this.connection && this.connection.currentState === 0 && this.connection.desiredState === 0) {
25319
25319
  this.connection.publish(topic, msg, aws_iot_device_sdk_v2__WEBPACK_IMPORTED_MODULE_2__.mqtt.QoS.AtLeastOnce, false);
25320
+ } else {
25321
+ throw new Error('Invalid topic or not connected:', topic);
25320
25322
  }
25321
25323
  }
25322
25324
  handleMessage(topic, payload) {