@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 +3 -0
- package/lib/socketCommands.js +10 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/socketCommands.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
|
329
|
+
key = `${pattern}####${patternFile}`;
|
|
323
330
|
} else {
|
|
324
331
|
key = pattern;
|
|
325
332
|
}
|