@ipsme/msgenv-mqtt 0.2.4 → 0.2.7

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.
@@ -31389,16 +31389,19 @@ class MsgEnvSingleton {
31389
31389
  hostname: 'localhost', // or '127.0.0.1'
31390
31390
  port: 1883
31391
31391
  });
31392
- this.client.on('error', function (err) {
31392
+ this.client.on('error', (err) => {
31393
31393
  console.error('MQTT Connection Error:', err);
31394
31394
  });
31395
- this.client.on('connect', function () {
31396
- // console.log('MQTT Connected');
31395
+ this.client.on('connect', () => {
31396
+ logr_.log(l_.CONNECTIONS, () => ['MQTT connected / reconnected successfully']);
31397
+ });
31398
+ this.client.on('disconnect', () => {
31399
+ logr_.log(l_.CONNECTIONS, () => ['MQTT clean disconnect']);
31397
31400
  });
31398
31401
  this.client.on('close', () => {
31399
- if (!this._disposed) {
31400
- logr_.log(l_.CONNECTIONS, () => ['MQTT client disconnected unexpectedly']);
31401
- }
31402
+ if (this._disposed)
31403
+ return;
31404
+ logr_.log(l_.CONNECTIONS, () => ['MQTT DISCONNECTED unexpectedly (will auto-reconnect)']);
31402
31405
  });
31403
31406
  }
31404
31407
  static get_instance() {
@@ -31387,16 +31387,19 @@ class MsgEnvSingleton {
31387
31387
  hostname: 'localhost', // or '127.0.0.1'
31388
31388
  port: 1883
31389
31389
  });
31390
- this.client.on('error', function (err) {
31390
+ this.client.on('error', (err) => {
31391
31391
  console.error('MQTT Connection Error:', err);
31392
31392
  });
31393
- this.client.on('connect', function () {
31394
- // console.log('MQTT Connected');
31393
+ this.client.on('connect', () => {
31394
+ logr_.log(l_.CONNECTIONS, () => ['MQTT connected / reconnected successfully']);
31395
+ });
31396
+ this.client.on('disconnect', () => {
31397
+ logr_.log(l_.CONNECTIONS, () => ['MQTT clean disconnect']);
31395
31398
  });
31396
31399
  this.client.on('close', () => {
31397
- if (!this._disposed) {
31398
- logr_.log(l_.CONNECTIONS, () => ['MQTT client disconnected unexpectedly']);
31399
- }
31400
+ if (this._disposed)
31401
+ return;
31402
+ logr_.log(l_.CONNECTIONS, () => ['MQTT DISCONNECTED unexpectedly (will auto-reconnect)']);
31400
31403
  });
31401
31404
  }
31402
31405
  static get_instance() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ipsme/msgenv-mqtt",
3
- "version": "0.2.4",
3
+ "version": "0.2.7",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
@@ -36,10 +36,10 @@
36
36
  "@rollup/plugin-json": "^6.1.0",
37
37
  "@rollup/plugin-node-resolve": "^16.0.3",
38
38
  "@rollup/plugin-typescript": "^12.3.0",
39
- "@types/node": "^25.5.0",
39
+ "@types/node": "^25.6.0",
40
40
  "del-cli": "^7.0.0",
41
- "rollup": "^4.60.0",
41
+ "rollup": "^4.60.1",
42
42
  "tslib": "^2.8.1",
43
- "typescript": "^6.0.2"
43
+ "typescript": "^6.0.3"
44
44
  }
45
45
  }
@@ -58,18 +58,21 @@ class MsgEnvSingleton {
58
58
  port: 1883
59
59
  });
60
60
 
61
- this.client.on('error', function (err) {
61
+ this.client.on('error', (err) => {
62
62
  console.error('MQTT Connection Error:', err);
63
63
  });
64
64
 
65
- this.client.on('connect', function () {
66
- // console.log('MQTT Connected');
65
+ this.client.on('connect', () => {
66
+ logr_.log(l_.CONNECTIONS, () => ['MQTT connected / reconnected successfully']);
67
+ });
68
+
69
+ this.client.on('disconnect', () => {
70
+ logr_.log(l_.CONNECTIONS, () => ['MQTT clean disconnect']);
67
71
  });
68
72
 
69
73
  this.client.on('close', () => {
70
- if (!this._disposed) {
71
- logr_.log(l_.CONNECTIONS, () => ['MQTT client disconnected unexpectedly']);
72
- }
74
+ if (this._disposed) return;
75
+ logr_.log(l_.CONNECTIONS, () => ['MQTT DISCONNECTED unexpectedly (will auto-reconnect)']);
73
76
  });
74
77
  }
75
78