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.
Files changed (2) hide show
  1. package/dist/stompClient.js +14 -18
  2. package/package.json +1 -1
@@ -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
- // const timeInterval =
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\uFF01---");
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
- // const timeInterval =
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('---连接已建立的关闭出错---', err);
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\uFF01");
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
- var subscription = _this.client.subscribe(pipe, function (response) {
221
- callback && callback(response);
222
- }, headers);
223
- _this.subscriptions[subscribeId] = subscription;
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
  // 如果是连接状态 正常执行函数
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkutils",
3
- "version": "2.7.13",
3
+ "version": "2.7.14",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",