@xelis/sdk 0.11.1 → 0.11.2
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.
|
@@ -76,7 +76,7 @@ var WSRPC = /** @class */ (function () {
|
|
|
76
76
|
};
|
|
77
77
|
WSRPC.prototype.listen = function (event, listener) {
|
|
78
78
|
return __awaiter(this, void 0, void 0, function () {
|
|
79
|
-
var eventData, idRefObject_1, onMessage;
|
|
79
|
+
var eventData, idRefObject_1, subscribed_1, onMessage;
|
|
80
80
|
var _this = this;
|
|
81
81
|
return __generator(this, function (_a) {
|
|
82
82
|
eventData = this.events.get(event);
|
|
@@ -87,7 +87,13 @@ var WSRPC = /** @class */ (function () {
|
|
|
87
87
|
else {
|
|
88
88
|
idRefObject_1 = {};
|
|
89
89
|
this.dataCall("subscribe", { notify: event }, idRefObject_1);
|
|
90
|
+
subscribed_1 = false;
|
|
90
91
|
onMessage = function (msgEvent) {
|
|
92
|
+
// the first message will return true if subscription is successful
|
|
93
|
+
if (!subscribed_1) {
|
|
94
|
+
subscribed_1 = true;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
91
97
|
var eventData = _this.events.get(event);
|
|
92
98
|
if (eventData && typeof msgEvent.data === "string") {
|
|
93
99
|
try {
|
|
@@ -70,7 +70,7 @@ var WSRPC = /** @class */ (function () {
|
|
|
70
70
|
};
|
|
71
71
|
WSRPC.prototype.listen = function (event, listener) {
|
|
72
72
|
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
-
var eventData, idRefObject_1, onMessage;
|
|
73
|
+
var eventData, idRefObject_1, subscribed_1, onMessage;
|
|
74
74
|
var _this = this;
|
|
75
75
|
return __generator(this, function (_a) {
|
|
76
76
|
eventData = this.events.get(event);
|
|
@@ -81,7 +81,13 @@ var WSRPC = /** @class */ (function () {
|
|
|
81
81
|
else {
|
|
82
82
|
idRefObject_1 = {};
|
|
83
83
|
this.dataCall("subscribe", { notify: event }, idRefObject_1);
|
|
84
|
+
subscribed_1 = false;
|
|
84
85
|
onMessage = function (msgEvent) {
|
|
86
|
+
// the first message will return true if subscription is successful
|
|
87
|
+
if (!subscribed_1) {
|
|
88
|
+
subscribed_1 = true;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
85
91
|
var eventData = _this.events.get(event);
|
|
86
92
|
if (eventData && typeof msgEvent.data === "string") {
|
|
87
93
|
try {
|
package/package.json
CHANGED