@iobroker/socket-classes 0.5.2 → 0.5.3

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/README.md CHANGED
@@ -69,6 +69,9 @@ io.close();
69
69
  -->
70
70
 
71
71
  ## Changelog
72
+ ### 0.5.3 (2022-08-24)
73
+ * (bluefox) Caught error by subscribe
74
+
72
75
  ### 0.5.2 (2022-08-19)
73
76
  * (bluefox) Added command `getCompactSystemRepositories`
74
77
 
@@ -262,6 +262,10 @@ class SocketCommands {
262
262
  }
263
263
 
264
264
  subscribe(socket, type, pattern, patternFile) {
265
+ if (!pattern) {
266
+ return this.adapter.log.warn('Empty pattern on subscribe!');
267
+ }
268
+
265
269
  this.subscribes[type] = this.subscribes[type] || {};
266
270
 
267
271
  let p;
@@ -269,7 +273,7 @@ class SocketCommands {
269
273
  pattern = pattern.toString();
270
274
  if (patternFile && type === 'fileChange') {
271
275
  patternFile = patternFile.toString();
272
- key = pattern + '####' + patternFile;
276
+ key = `${pattern}####${patternFile}`;
273
277
  } else {
274
278
  key = pattern;
275
279
  }
@@ -310,7 +314,10 @@ class SocketCommands {
310
314
  };
311
315
 
312
316
  unsubscribe(socket, type, pattern, patternFile) {
313
- //console.log((socket._name || socket.id) + ' unsubscribe ' + pattern);
317
+ if (!pattern) {
318
+ return this.adapter.log.warn('Empty pattern on subscribe!');
319
+ }
320
+ // console.log((socket._name || socket.id) + ' unsubscribe ' + pattern);
314
321
  if (!this.subscribes[type]) {
315
322
  return;
316
323
  }
@@ -319,7 +326,7 @@ class SocketCommands {
319
326
  pattern = pattern.toString();
320
327
  if (patternFile && type === 'fileChange') {
321
328
  patternFile = patternFile.toString();
322
- key = pattern + '####' + patternFile;
329
+ key = `${pattern}####${patternFile}`;
323
330
  } else {
324
331
  key = pattern;
325
332
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/socket-classes",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "ioBroker server-side web sockets",
5
5
  "author": {
6
6
  "name": "bluefox",