@remix_labs/hub-client 2.12979.0-dev → 2.12982.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 +5 -38
- package/package.json +1 -1
package/common.js
CHANGED
|
@@ -299,7 +299,7 @@ class Channel {
|
|
|
299
299
|
this.port.onmessage = (ev => {
|
|
300
300
|
try {
|
|
301
301
|
let f = this.expect.get(ev.data.reqId);
|
|
302
|
-
if (ev.
|
|
302
|
+
if (ev.eof) {
|
|
303
303
|
this.expect.delete(ev.data.reqId);
|
|
304
304
|
};
|
|
305
305
|
f(ev);
|
|
@@ -388,26 +388,6 @@ class Channel {
|
|
|
388
388
|
})
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
disconnect(clientName) {
|
|
392
|
-
return new Promise((resolve, reject) => {
|
|
393
|
-
let reqId = this.reqId + 1;
|
|
394
|
-
this.reqId = reqId;
|
|
395
|
-
this.expect.set(reqId, (resp => {
|
|
396
|
-
this.expect.delete(reqId);
|
|
397
|
-
if (resp.data.error == null) {
|
|
398
|
-
resolve(resp.data)
|
|
399
|
-
} else
|
|
400
|
-
reject(resp.data);
|
|
401
|
-
}));
|
|
402
|
-
let disconnMsg =
|
|
403
|
-
{ _rmx_type: "msg_hub_disconnect",
|
|
404
|
-
reqId: reqId,
|
|
405
|
-
clientName: clientName
|
|
406
|
-
};
|
|
407
|
-
this.port.postMessage(disconnMsg)
|
|
408
|
-
})
|
|
409
|
-
}
|
|
410
|
-
|
|
411
391
|
setLocalPubTopic(topic) {
|
|
412
392
|
return new Promise((resolve, reject) => {
|
|
413
393
|
let reqId = this.reqId + 1;
|
|
@@ -446,17 +426,7 @@ class Channel {
|
|
|
446
426
|
})
|
|
447
427
|
}
|
|
448
428
|
|
|
449
|
-
newChannel(
|
|
450
|
-
// regarding clientName: by adding a clientName to a
|
|
451
|
-
// channel all requests are associated with this
|
|
452
|
-
// name. Keep in mind how a VM is started:
|
|
453
|
-
// - first, a channel is created
|
|
454
|
-
// - then, the worker starts up
|
|
455
|
-
// - then, the port of the channel is sent to the worker
|
|
456
|
-
// - this port is then used by the worker for all requests sent
|
|
457
|
-
// to the messaging hub
|
|
458
|
-
// This way, all requests submitted from the worker are associated
|
|
459
|
-
// with the clientName.
|
|
429
|
+
newChannel() {
|
|
460
430
|
return new Promise((resolve, reject) => {
|
|
461
431
|
let reqId = this.reqId + 1;
|
|
462
432
|
this.reqId = reqId;
|
|
@@ -471,8 +441,7 @@ class Channel {
|
|
|
471
441
|
}));
|
|
472
442
|
let msg =
|
|
473
443
|
{ _rmx_type: "msg_hub_newChannel",
|
|
474
|
-
reqId: reqId
|
|
475
|
-
clientName: clientName
|
|
444
|
+
reqId: reqId
|
|
476
445
|
};
|
|
477
446
|
this.port.postMessage(msg);
|
|
478
447
|
})
|
|
@@ -562,7 +531,7 @@ class Worker {
|
|
|
562
531
|
})
|
|
563
532
|
}
|
|
564
533
|
|
|
565
|
-
newChannel(
|
|
534
|
+
newChannel() {
|
|
566
535
|
let thisworker = this;
|
|
567
536
|
return new Promise((resolve, reject) => {
|
|
568
537
|
thisworker.expect.push(resp => {
|
|
@@ -574,9 +543,7 @@ class Worker {
|
|
|
574
543
|
reject(resp.data)
|
|
575
544
|
});
|
|
576
545
|
let msg =
|
|
577
|
-
{ "_rmx_type": "msg_hub_newChannel"
|
|
578
|
-
clientName: clientName
|
|
579
|
-
};
|
|
546
|
+
{ "_rmx_type": "msg_hub_newChannel" };
|
|
580
547
|
thisworker.worker.postMessage(msg);
|
|
581
548
|
})
|
|
582
549
|
}
|