kucservice 1.5.2 → 1.5.3
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/kucservice.common.js +12 -3
- package/dist/kucservice.common.js.gz +0 -0
- package/dist/kucservice.common.js.map +1 -1
- package/dist/kucservice.umd.js +12 -3
- package/dist/kucservice.umd.js.gz +0 -0
- package/dist/kucservice.umd.js.map +1 -1
- package/dist/kucservice.umd.min.js +1 -1
- package/dist/kucservice.umd.min.js.gz +0 -0
- package/dist/kucservice.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -2182,6 +2182,8 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2182
2182
|
|
|
2183
2183
|
Object(defineProperty["a" /* default */])(_assertThisInitialized(_this), "firstConnect", false);
|
|
2184
2184
|
|
|
2185
|
+
Object(defineProperty["a" /* default */])(_assertThisInitialized(_this), "isManualClose", false);
|
|
2186
|
+
|
|
2185
2187
|
_this.self = _self;
|
|
2186
2188
|
_this._currentOptions = options;
|
|
2187
2189
|
_this._dep = dep;
|
|
@@ -2216,7 +2218,7 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2216
2218
|
this._dep.notify('close', e); // 如果WebSocket是非正常关闭 则进行重连
|
|
2217
2219
|
|
|
2218
2220
|
|
|
2219
|
-
if (e.code !== CLOSE_ABNORMAL) {
|
|
2221
|
+
if (e.code !== CLOSE_ABNORMAL && !this.isManualClose) {
|
|
2220
2222
|
var _this$self;
|
|
2221
2223
|
|
|
2222
2224
|
// if (this._reconnectCount < this.heartCheckCount) {
|
|
@@ -2247,11 +2249,14 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2247
2249
|
// }
|
|
2248
2250
|
|
|
2249
2251
|
} else {
|
|
2252
|
+
this.isManualClose = false;
|
|
2250
2253
|
this.clearHeartCheck();
|
|
2251
2254
|
this.onopen = null;
|
|
2252
2255
|
this.onclose = null;
|
|
2253
2256
|
this.onerror = null;
|
|
2254
2257
|
this.onmessage = null;
|
|
2258
|
+
|
|
2259
|
+
this._dep.notify('close', e, true);
|
|
2255
2260
|
}
|
|
2256
2261
|
};
|
|
2257
2262
|
|
|
@@ -2313,13 +2318,16 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2313
2318
|
}, {
|
|
2314
2319
|
key: "closeSocket",
|
|
2315
2320
|
value: function closeSocket(code, reason) {
|
|
2321
|
+
this.isManualClose = true;
|
|
2316
2322
|
this.clearHeartCheck();
|
|
2317
2323
|
console.log('=====close code===', code, reason); // this.onopen = null
|
|
2318
2324
|
// this.onclose = null
|
|
2319
2325
|
// this.onerror = null
|
|
2320
2326
|
// this.onmessage = null
|
|
2321
2327
|
|
|
2322
|
-
this.
|
|
2328
|
+
if (this && this.readyState === this.OPEN) {
|
|
2329
|
+
this.close(code || 1000, reason);
|
|
2330
|
+
}
|
|
2323
2331
|
} // 开始心跳检测
|
|
2324
2332
|
|
|
2325
2333
|
}, {
|
|
@@ -11415,9 +11423,10 @@ var initWsBaseTheme = function initWsBaseTheme(socket, _ref) {
|
|
|
11415
11423
|
console.log('WebSocket连接成功!');
|
|
11416
11424
|
onOpen && onOpen();
|
|
11417
11425
|
});
|
|
11418
|
-
socket.subscribe('close', function (reason) {
|
|
11426
|
+
socket.subscribe('close', function (reason, isManualClose) {
|
|
11419
11427
|
console.log('WebSocket连接关闭!', reason);
|
|
11420
11428
|
onClose && onClose(reason);
|
|
11429
|
+
isManualClose && (socket = null);
|
|
11421
11430
|
});
|
|
11422
11431
|
socket.subscribe('message', function (result) {
|
|
11423
11432
|
onMessage && onMessage(result);
|
|
Binary file
|