ztxkutils 2.10.30 → 2.10.32
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.d.ts +1 -0
- package/dist/stompClient.js +31 -0
- package/package.json +1 -1
package/dist/stompClient.d.ts
CHANGED
package/dist/stompClient.js
CHANGED
@@ -13,6 +13,7 @@ var StompClient = /** @class */ (function () {
|
|
13
13
|
this.successCallbacks = {}; // 连接成功执行的回调存储对象
|
14
14
|
this.errorCallbacks = {}; // 连接失败执行的回调存储对象
|
15
15
|
this.reconnectionNum = 0; // 重连次数
|
16
|
+
this.userClose = false; // 是否用户主动关闭
|
16
17
|
this.isInit = false;
|
17
18
|
this.connectWsConfig = connectWsConfig;
|
18
19
|
}
|
@@ -27,6 +28,7 @@ var StompClient = /** @class */ (function () {
|
|
27
28
|
// 获取 STOMP 子协议的客户端对象
|
28
29
|
this.client = Stomp.over(socket);
|
29
30
|
this.isClient = false;
|
31
|
+
this.userClose = false; // 重新初始化 重新计算
|
30
32
|
// 如果存在 证明已经初始化过,直接删除
|
31
33
|
if (this.clearIsClient) {
|
32
34
|
clearTimeout(this.clearIsClient);
|
@@ -129,6 +131,22 @@ var StompClient = /** @class */ (function () {
|
|
129
131
|
function (err) {
|
130
132
|
console.log("---------\u8FDE\u63A5\u5931\u8D25 system=" + _this.connectWsConfig.systemType + " time=" + Date.now() + "--------");
|
131
133
|
console.log(err);
|
134
|
+
if (_this.userClose) {
|
135
|
+
if (_this.clearIsClient) {
|
136
|
+
clearTimeout(_this.clearIsClient);
|
137
|
+
_this.clearIsClient = null;
|
138
|
+
}
|
139
|
+
if (_this.clearIsClientNo) {
|
140
|
+
clearTimeout(_this.clearIsClientNo);
|
141
|
+
_this.clearIsClientNo = null;
|
142
|
+
}
|
143
|
+
if (_this.clearIsClientYes) {
|
144
|
+
clearTimeout(_this.clearIsClientYes);
|
145
|
+
_this.clearIsClientYes = null;
|
146
|
+
}
|
147
|
+
console.log('用户主动关闭');
|
148
|
+
return;
|
149
|
+
}
|
132
150
|
_this.isClient = true;
|
133
151
|
if (_this.clearIsClient) {
|
134
152
|
clearTimeout(_this.clearIsClient);
|
@@ -247,6 +265,19 @@ var StompClient = /** @class */ (function () {
|
|
247
265
|
StompClient.prototype.disconnect = function (callback) {
|
248
266
|
var _this = this;
|
249
267
|
this.isInit = false;
|
268
|
+
this.userClose = true;
|
269
|
+
if (this.clearIsClient) {
|
270
|
+
clearTimeout(this.clearIsClient);
|
271
|
+
this.clearIsClient = null;
|
272
|
+
}
|
273
|
+
if (this.clearIsClientNo) {
|
274
|
+
clearTimeout(this.clearIsClientNo);
|
275
|
+
this.clearIsClientNo = null;
|
276
|
+
}
|
277
|
+
if (this.clearIsClientYes) {
|
278
|
+
clearTimeout(this.clearIsClientYes);
|
279
|
+
this.clearIsClientYes = null;
|
280
|
+
}
|
250
281
|
return new Promise(function (resolve, reject) {
|
251
282
|
try {
|
252
283
|
_this.client.disconnect(function () {
|