@remix_labs/hub-client 2.12919.0-dev → 2.12921.0-dev
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/common.js +28 -4
- package/package.json +1 -1
package/common.js
CHANGED
|
@@ -388,6 +388,27 @@ class Channel {
|
|
|
388
388
|
})
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
+
unsubscribeClient(clientName) {
|
|
392
|
+
return new Promise((resolve, reject) => {
|
|
393
|
+
let reqId = this.reqId + 1;
|
|
394
|
+
let subId = reqId + 1;
|
|
395
|
+
this.reqId = subId;
|
|
396
|
+
this.expect.set(reqId, (resp => {
|
|
397
|
+
this.expect.delete(reqId);
|
|
398
|
+
if (resp.data.error == null) {
|
|
399
|
+
resolve(resp.data)
|
|
400
|
+
} else
|
|
401
|
+
reject(resp.data);
|
|
402
|
+
}));
|
|
403
|
+
let unsubMsg =
|
|
404
|
+
{ _rmx_type: "msg_hub_unsubscribeClient",
|
|
405
|
+
reqId: reqId,
|
|
406
|
+
clientName: clientName
|
|
407
|
+
};
|
|
408
|
+
this.port.postMessage(unsubMsg)
|
|
409
|
+
})
|
|
410
|
+
}
|
|
411
|
+
|
|
391
412
|
setLocalPubTopic(topic) {
|
|
392
413
|
return new Promise((resolve, reject) => {
|
|
393
414
|
let reqId = this.reqId + 1;
|
|
@@ -426,7 +447,7 @@ class Channel {
|
|
|
426
447
|
})
|
|
427
448
|
}
|
|
428
449
|
|
|
429
|
-
newChannel() {
|
|
450
|
+
newChannel(clientName) {
|
|
430
451
|
return new Promise((resolve, reject) => {
|
|
431
452
|
let reqId = this.reqId + 1;
|
|
432
453
|
this.reqId = reqId;
|
|
@@ -441,7 +462,8 @@ class Channel {
|
|
|
441
462
|
}));
|
|
442
463
|
let msg =
|
|
443
464
|
{ _rmx_type: "msg_hub_newChannel",
|
|
444
|
-
reqId: reqId
|
|
465
|
+
reqId: reqId,
|
|
466
|
+
clientName: clientName
|
|
445
467
|
};
|
|
446
468
|
this.port.postMessage(msg);
|
|
447
469
|
})
|
|
@@ -531,7 +553,7 @@ class Worker {
|
|
|
531
553
|
})
|
|
532
554
|
}
|
|
533
555
|
|
|
534
|
-
newChannel() {
|
|
556
|
+
newChannel(clientName) {
|
|
535
557
|
let thisworker = this;
|
|
536
558
|
return new Promise((resolve, reject) => {
|
|
537
559
|
thisworker.expect.push(resp => {
|
|
@@ -543,7 +565,9 @@ class Worker {
|
|
|
543
565
|
reject(resp.data)
|
|
544
566
|
});
|
|
545
567
|
let msg =
|
|
546
|
-
{ "_rmx_type": "msg_hub_newChannel"
|
|
568
|
+
{ "_rmx_type": "msg_hub_newChannel",
|
|
569
|
+
clientName: clientName
|
|
570
|
+
};
|
|
547
571
|
thisworker.worker.postMessage(msg);
|
|
548
572
|
})
|
|
549
573
|
}
|