kucservice 1.5.1 → 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 +30 -11
- package/dist/kucservice.common.js.gz +0 -0
- package/dist/kucservice.common.js.map +1 -1
- package/dist/kucservice.umd.js +30 -11
- 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) {
|
|
@@ -2242,7 +2244,12 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2242
2244
|
this.self.socketTimer = setTimeout(function () {
|
|
2243
2245
|
var _socket = new Socket(optionsClone, _this2._dep, _this2._reconnectCount, _this2.self);
|
|
2244
2246
|
|
|
2245
|
-
_this2.
|
|
2247
|
+
_this2.clearHeartCheck();
|
|
2248
|
+
|
|
2249
|
+
_this2.onopen = null;
|
|
2250
|
+
_this2.onclose = null;
|
|
2251
|
+
_this2.onerror = null;
|
|
2252
|
+
_this2.onmessage = null;
|
|
2246
2253
|
|
|
2247
2254
|
_this2._dep.notify('reconnect', _socket);
|
|
2248
2255
|
}, TIMEOUT);
|
|
@@ -2250,6 +2257,15 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2250
2257
|
// return console.error('WebSocket重连失败, 请联系技术客服!')
|
|
2251
2258
|
// }
|
|
2252
2259
|
|
|
2260
|
+
} else {
|
|
2261
|
+
this.isManualClose = false;
|
|
2262
|
+
this.clearHeartCheck();
|
|
2263
|
+
this.onopen = null;
|
|
2264
|
+
this.onclose = null;
|
|
2265
|
+
this.onerror = null;
|
|
2266
|
+
this.onmessage = null;
|
|
2267
|
+
|
|
2268
|
+
this._dep.notify('close', e, true);
|
|
2253
2269
|
}
|
|
2254
2270
|
};
|
|
2255
2271
|
|
|
@@ -2311,13 +2327,16 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2311
2327
|
}, {
|
|
2312
2328
|
key: "closeSocket",
|
|
2313
2329
|
value: function closeSocket(code, reason) {
|
|
2330
|
+
this.isManualClose = true;
|
|
2314
2331
|
this.clearHeartCheck();
|
|
2315
|
-
console.log('=====close code===', code, reason);
|
|
2316
|
-
this.
|
|
2317
|
-
this.
|
|
2318
|
-
this.
|
|
2319
|
-
|
|
2320
|
-
this.
|
|
2332
|
+
console.log('=====close code===', code, reason); // this.onopen = null
|
|
2333
|
+
// this.onclose = null
|
|
2334
|
+
// this.onerror = null
|
|
2335
|
+
// this.onmessage = null
|
|
2336
|
+
|
|
2337
|
+
if (this && this.readyState === this.OPEN) {
|
|
2338
|
+
this.close(code || 1000, reason);
|
|
2339
|
+
}
|
|
2321
2340
|
} // 开始心跳检测
|
|
2322
2341
|
|
|
2323
2342
|
}, {
|
|
@@ -11413,9 +11432,10 @@ var initWsBaseTheme = function initWsBaseTheme(socket, _ref) {
|
|
|
11413
11432
|
console.log('WebSocket连接成功!');
|
|
11414
11433
|
onOpen && onOpen();
|
|
11415
11434
|
});
|
|
11416
|
-
socket.subscribe('close', function (reason) {
|
|
11435
|
+
socket.subscribe('close', function (reason, isManualClose) {
|
|
11417
11436
|
console.log('WebSocket连接关闭!', reason);
|
|
11418
11437
|
onClose && onClose(reason);
|
|
11438
|
+
isManualClose && (socket = null);
|
|
11419
11439
|
});
|
|
11420
11440
|
socket.subscribe('message', function (result) {
|
|
11421
11441
|
onMessage && onMessage(result);
|
|
@@ -11620,8 +11640,7 @@ var common_request_wsClass = /*#__PURE__*/function () {
|
|
|
11620
11640
|
_classPrivateFieldSet(this, _player, null);
|
|
11621
11641
|
|
|
11622
11642
|
this.socketTimer && clearTimeout(this.socketTimer);
|
|
11623
|
-
(_this$socket2 = this.socket) === null || _this$socket2 === void 0 ? void 0 : _this$socket2.closeSocket(1000, '通知关闭websocket连接');
|
|
11624
|
-
this.socket = null;
|
|
11643
|
+
(_this$socket2 = this.socket) === null || _this$socket2 === void 0 ? void 0 : _this$socket2.closeSocket(1000, '通知关闭websocket连接'); // this.socket = null
|
|
11625
11644
|
|
|
11626
11645
|
if (_classPrivateFieldGet(this, _phoneClientObj)) {
|
|
11627
11646
|
_classPrivateFieldGet(this, _phoneClientObj).onclose();
|
|
Binary file
|