ztxkutils 2.7.13 → 2.7.14
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/dist/stompClient.js +14 -18
- package/package.json +1 -1
package/dist/stompClient.js
CHANGED
@@ -43,21 +43,18 @@ var StompClient = /** @class */ (function () {
|
|
43
43
|
this.clearIsClient = setTimeout(function () {
|
44
44
|
_this.clearIsClient = null;
|
45
45
|
if (!_this.isClient) {
|
46
|
-
console.log("\u8FDE\u63A5\u5DF2\u53D1\u8D77\uFF0C\u4F46\u662F10\u79D2\u540E\u672A\u6210\u529F\u5EFA\u7ACB\u8FDE\u63A5\uFF0C\u624B\u52A8\u65AD\u5F00\u91CD\u8FDE!");
|
46
|
+
console.log("\u8FDE\u63A5\u5DF2\u53D1\u8D77\uFF0C\u4F46\u662F10\u79D2\u540E\u672A\u6210\u529F\u5EFA\u7ACB\u8FDE\u63A5\uFF0C\u624B\u52A8\u65AD\u5F00\u91CD\u8FDE!system=" + _this.connectWsConfig.systemType);
|
47
47
|
try {
|
48
48
|
_this.client.disconnect(function () {
|
49
|
-
|
50
|
-
// Math.ceil(this.reconnectionNum / 5) *
|
51
|
-
// (this.connectWsConfig.reconnectionTime ?? 3000);
|
49
|
+
_this.client = null;
|
52
50
|
});
|
53
51
|
}
|
54
52
|
catch (err) {
|
55
53
|
console.log('---连接未建立的关闭出错---', err);
|
56
54
|
}
|
57
|
-
_this.client = null;
|
58
55
|
_this.reconnectionNum++;
|
59
56
|
var timeInterval = 3000;
|
60
|
-
console.log("---\u7B2C" + _this.reconnectionNum + "\u6B21\u91CD\u8FDE\
|
57
|
+
console.log("---\u7B2C" + _this.reconnectionNum + "\u6B21\u91CD\u8FDE\uFF01time=" + Date.now() + "system=" + _this.connectWsConfig.systemType + "---");
|
61
58
|
if (_this.clearIsClientNo) {
|
62
59
|
clearTimeout(_this.clearIsClientNo);
|
63
60
|
_this.clearIsClientNo = null;
|
@@ -95,7 +92,7 @@ var StompClient = /** @class */ (function () {
|
|
95
92
|
_this.clearIsClientYes = null;
|
96
93
|
}
|
97
94
|
_this.reconnectionNum = 0;
|
98
|
-
console.log(
|
95
|
+
console.log("---------\u8FDE\u63A5\u6210\u529F time=" + Date.now() + " system=" + _this.connectWsConfig.systemType + " time=" + Date.now() + "--------");
|
99
96
|
// 连接成功后,将当前已注册的,未执行的 连接通道 连接
|
100
97
|
var subscriptionsFnKeys = Object.keys(_this.subscriptionsFn);
|
101
98
|
if (Array.isArray(subscriptionsFnKeys)) {
|
@@ -128,7 +125,7 @@ var StompClient = /** @class */ (function () {
|
|
128
125
|
},
|
129
126
|
// 连接失败回调
|
130
127
|
function (err) {
|
131
|
-
console.log(
|
128
|
+
console.log("---------\u8FDE\u63A5\u5931\u8D25 system=" + _this.connectWsConfig.systemType + " time=" + Date.now() + "--------");
|
132
129
|
console.log(err);
|
133
130
|
_this.isClient = true;
|
134
131
|
if (_this.clearIsClient) {
|
@@ -173,21 +170,18 @@ var StompClient = /** @class */ (function () {
|
|
173
170
|
// 重连间隔,每隔5秒递增,超过最大间隔时间后,取最大间隔时间重连
|
174
171
|
try {
|
175
172
|
_this.client.disconnect(function () {
|
176
|
-
|
177
|
-
// Math.ceil(this.reconnectionNum / 5) *
|
178
|
-
// (this.connectWsConfig.reconnectionTime ?? 3000);
|
173
|
+
_this.client = null;
|
179
174
|
});
|
180
175
|
}
|
181
176
|
catch (err) {
|
182
|
-
console.log(
|
177
|
+
console.log("---\u8FDE\u63A5\u5DF2\u5EFA\u7ACB\u7684\u5173\u95ED\u51FA\u9519 time=" + Date.now() + "system=" + _this.connectWsConfig.systemType + "---", err);
|
183
178
|
}
|
184
|
-
_this.client = null;
|
185
179
|
_this.reconnectionNum++;
|
186
180
|
// const timeInterval =
|
187
181
|
// Math.ceil(this.reconnectionNum / 5) *
|
188
182
|
// (this.connectWsConfig.reconnectionTime ?? 3000);
|
189
183
|
var timeInterval = 3000;
|
190
|
-
console.log("---\u7B2C" + _this.reconnectionNum + "\u6B21\u91CD\u8FDE\
|
184
|
+
console.log("---\u7B2C" + _this.reconnectionNum + "\u6B21\u91CD\u8FDE\uFF01time=" + Date.now() + "system=" + _this.connectWsConfig.systemType);
|
191
185
|
_this.clearIsClientYes = setTimeout(function () {
|
192
186
|
_this.init();
|
193
187
|
}, timeInterval);
|
@@ -217,10 +211,12 @@ var StompClient = /** @class */ (function () {
|
|
217
211
|
callback = undefined;
|
218
212
|
}
|
219
213
|
var subscriptionsFn = function () {
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
214
|
+
if (_this.client) {
|
215
|
+
var subscription = _this.client.subscribe(pipe, function (response) {
|
216
|
+
callback && callback(response);
|
217
|
+
}, headers);
|
218
|
+
_this.subscriptions[subscribeId] = subscription;
|
219
|
+
}
|
224
220
|
};
|
225
221
|
if ((_a = this.client) === null || _a === void 0 ? void 0 : _a.connected) {
|
226
222
|
// 如果是连接状态 正常执行函数
|