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
package/dist/kucservice.umd.js
CHANGED
|
@@ -2191,6 +2191,8 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2191
2191
|
|
|
2192
2192
|
Object(defineProperty["a" /* default */])(_assertThisInitialized(_this), "firstConnect", false);
|
|
2193
2193
|
|
|
2194
|
+
Object(defineProperty["a" /* default */])(_assertThisInitialized(_this), "isManualClose", false);
|
|
2195
|
+
|
|
2194
2196
|
_this.self = _self;
|
|
2195
2197
|
_this._currentOptions = options;
|
|
2196
2198
|
_this._dep = dep;
|
|
@@ -2225,7 +2227,7 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2225
2227
|
this._dep.notify('close', e); // 如果WebSocket是非正常关闭 则进行重连
|
|
2226
2228
|
|
|
2227
2229
|
|
|
2228
|
-
if (e.code !== CLOSE_ABNORMAL) {
|
|
2230
|
+
if (e.code !== CLOSE_ABNORMAL && !this.isManualClose) {
|
|
2229
2231
|
var _this$self;
|
|
2230
2232
|
|
|
2231
2233
|
// if (this._reconnectCount < this.heartCheckCount) {
|
|
@@ -2256,11 +2258,14 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2256
2258
|
// }
|
|
2257
2259
|
|
|
2258
2260
|
} else {
|
|
2261
|
+
this.isManualClose = false;
|
|
2259
2262
|
this.clearHeartCheck();
|
|
2260
2263
|
this.onopen = null;
|
|
2261
2264
|
this.onclose = null;
|
|
2262
2265
|
this.onerror = null;
|
|
2263
2266
|
this.onmessage = null;
|
|
2267
|
+
|
|
2268
|
+
this._dep.notify('close', e, true);
|
|
2264
2269
|
}
|
|
2265
2270
|
};
|
|
2266
2271
|
|
|
@@ -2322,13 +2327,16 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2322
2327
|
}, {
|
|
2323
2328
|
key: "closeSocket",
|
|
2324
2329
|
value: function closeSocket(code, reason) {
|
|
2330
|
+
this.isManualClose = true;
|
|
2325
2331
|
this.clearHeartCheck();
|
|
2326
2332
|
console.log('=====close code===', code, reason); // this.onopen = null
|
|
2327
2333
|
// this.onclose = null
|
|
2328
2334
|
// this.onerror = null
|
|
2329
2335
|
// this.onmessage = null
|
|
2330
2336
|
|
|
2331
|
-
this.
|
|
2337
|
+
if (this && this.readyState === this.OPEN) {
|
|
2338
|
+
this.close(code || 1000, reason);
|
|
2339
|
+
}
|
|
2332
2340
|
} // 开始心跳检测
|
|
2333
2341
|
|
|
2334
2342
|
}, {
|
|
@@ -11424,9 +11432,10 @@ var initWsBaseTheme = function initWsBaseTheme(socket, _ref) {
|
|
|
11424
11432
|
console.log('WebSocket连接成功!');
|
|
11425
11433
|
onOpen && onOpen();
|
|
11426
11434
|
});
|
|
11427
|
-
socket.subscribe('close', function (reason) {
|
|
11435
|
+
socket.subscribe('close', function (reason, isManualClose) {
|
|
11428
11436
|
console.log('WebSocket连接关闭!', reason);
|
|
11429
11437
|
onClose && onClose(reason);
|
|
11438
|
+
isManualClose && (socket = null);
|
|
11430
11439
|
});
|
|
11431
11440
|
socket.subscribe('message', function (result) {
|
|
11432
11441
|
onMessage && onMessage(result);
|
|
Binary file
|