kucservice 1.4.7 → 1.4.9
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 +72 -45
- package/dist/kucservice.common.js.gz +0 -0
- package/dist/kucservice.common.js.map +1 -1
- package/dist/kucservice.umd.js +72 -45
- 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
|
@@ -2087,7 +2087,7 @@ var es_json_stringify = __webpack_require__("e9c4");
|
|
|
2087
2087
|
var EventTypes = ['open', 'close', 'message', 'error', 'reconnect'];
|
|
2088
2088
|
var DEFAULT_CHECK_TIME = 30 * 1000; // 心跳检测的默认时间
|
|
2089
2089
|
|
|
2090
|
-
var TIMEOUT =
|
|
2090
|
+
var TIMEOUT = 100; //重连延迟时间
|
|
2091
2091
|
|
|
2092
2092
|
var DEFAULT_CHECK_COUNT = 10; // 心跳检测默认失败重连次数
|
|
2093
2093
|
|
|
@@ -2220,6 +2220,8 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2220
2220
|
this.onclose = function (e) {
|
|
2221
2221
|
var _this2 = this;
|
|
2222
2222
|
|
|
2223
|
+
console.error('webSocket关闭', e);
|
|
2224
|
+
|
|
2223
2225
|
this._dep.notify('close', e); // 如果WebSocket是非正常关闭 则进行重连
|
|
2224
2226
|
|
|
2225
2227
|
|
|
@@ -11483,12 +11485,10 @@ var _phoneClientObj = /*#__PURE__*/new WeakMap();
|
|
|
11483
11485
|
|
|
11484
11486
|
var common_request_wsClass = /*#__PURE__*/function () {
|
|
11485
11487
|
function wsClass(config, _ref2) {
|
|
11486
|
-
var
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
_onMessage = _ref2.onMessage,
|
|
11491
|
-
_onError = _ref2.onError,
|
|
11488
|
+
var onOpen = _ref2.onOpen,
|
|
11489
|
+
onClose = _ref2.onClose,
|
|
11490
|
+
onMessage = _ref2.onMessage,
|
|
11491
|
+
onError = _ref2.onError,
|
|
11492
11492
|
initAction = _ref2.initAction;
|
|
11493
11493
|
|
|
11494
11494
|
Object(classCallCheck["a" /* default */])(this, wsClass);
|
|
@@ -11508,42 +11508,68 @@ var common_request_wsClass = /*#__PURE__*/function () {
|
|
|
11508
11508
|
Object.assign(this.config, {
|
|
11509
11509
|
checkData: JSON.stringify(GetSendModel('keeplive', this.config))
|
|
11510
11510
|
});
|
|
11511
|
-
this.socket = common_request_useRequest('websocket')(config);
|
|
11512
|
-
|
|
11513
|
-
onOpen:
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
_this.send('Login');
|
|
11519
|
-
|
|
11520
|
-
_onOpen && _onOpen(e);
|
|
11521
|
-
},
|
|
11522
|
-
onClose: function onClose(e) {
|
|
11523
|
-
_onClose && _onClose(e);
|
|
11524
|
-
},
|
|
11525
|
-
onMessage: function onMessage(e) {
|
|
11526
|
-
var data = e.data || e;
|
|
11527
|
-
|
|
11528
|
-
if (data.indexOf('Back_Login(') === 0) {
|
|
11529
|
-
// 设置坐席
|
|
11530
|
-
_this.config.AgentGroupName && _this.send("SetGroupRole", _this.config.AgentGroupName); // 初始化操作
|
|
11531
|
-
|
|
11532
|
-
initAction && initAction(); // return
|
|
11533
|
-
}
|
|
11534
|
-
|
|
11535
|
-
_onMessage && _onMessage(e);
|
|
11536
|
-
},
|
|
11537
|
-
onError: function onError(e) {
|
|
11538
|
-
_onError && _onError(e);
|
|
11539
|
-
},
|
|
11540
|
-
onReconnect: function onReconnect(e) {
|
|
11541
|
-
_this.scoket = e;
|
|
11542
|
-
}
|
|
11511
|
+
this.socket = common_request_useRequest('websocket')(config, this);
|
|
11512
|
+
this.initSocket({
|
|
11513
|
+
onOpen: onOpen,
|
|
11514
|
+
onClose: onClose,
|
|
11515
|
+
onMessage: onMessage,
|
|
11516
|
+
onError: onError,
|
|
11517
|
+
initAction: initAction
|
|
11543
11518
|
});
|
|
11544
11519
|
}
|
|
11545
11520
|
|
|
11546
11521
|
Object(createClass["a" /* default */])(wsClass, [{
|
|
11522
|
+
key: "initSocket",
|
|
11523
|
+
value: function initSocket(_ref3) {
|
|
11524
|
+
var _this = this;
|
|
11525
|
+
|
|
11526
|
+
var _onOpen = _ref3.onOpen,
|
|
11527
|
+
_onClose = _ref3.onClose,
|
|
11528
|
+
_onMessage = _ref3.onMessage,
|
|
11529
|
+
_onError = _ref3.onError,
|
|
11530
|
+
initAction = _ref3.initAction;
|
|
11531
|
+
initWsBaseTheme(this.socket, {
|
|
11532
|
+
onOpen: function onOpen(e) {
|
|
11533
|
+
// 登录
|
|
11534
|
+
console.log('====onOpen=====');
|
|
11535
|
+
console.log(_this);
|
|
11536
|
+
|
|
11537
|
+
_this.send('Login');
|
|
11538
|
+
|
|
11539
|
+
_onOpen && _onOpen(e);
|
|
11540
|
+
},
|
|
11541
|
+
onClose: function onClose(e) {
|
|
11542
|
+
_onClose && _onClose(e);
|
|
11543
|
+
},
|
|
11544
|
+
onMessage: function onMessage(e) {
|
|
11545
|
+
var data = e.data || e;
|
|
11546
|
+
|
|
11547
|
+
if (data.indexOf('Back_Login(') === 0) {
|
|
11548
|
+
// 设置坐席
|
|
11549
|
+
_this.config.AgentGroupName && _this.send("SetGroupRole", _this.config.AgentGroupName); // 初始化操作
|
|
11550
|
+
|
|
11551
|
+
initAction && initAction(); // return
|
|
11552
|
+
}
|
|
11553
|
+
|
|
11554
|
+
_onMessage && _onMessage(e);
|
|
11555
|
+
},
|
|
11556
|
+
onError: function onError(e) {
|
|
11557
|
+
_onError && _onError(e);
|
|
11558
|
+
},
|
|
11559
|
+
onReconnect: function onReconnect(e) {
|
|
11560
|
+
_this.scoket = e;
|
|
11561
|
+
|
|
11562
|
+
_this.initSocket({
|
|
11563
|
+
onOpen: _onOpen,
|
|
11564
|
+
onClose: _onClose,
|
|
11565
|
+
onMessage: _onMessage,
|
|
11566
|
+
onError: _onError,
|
|
11567
|
+
initAction: initAction
|
|
11568
|
+
});
|
|
11569
|
+
}
|
|
11570
|
+
});
|
|
11571
|
+
}
|
|
11572
|
+
}, {
|
|
11547
11573
|
key: "send",
|
|
11548
11574
|
value: function send(action, params) {
|
|
11549
11575
|
var _this$socket;
|
|
@@ -11586,6 +11612,7 @@ var common_request_wsClass = /*#__PURE__*/function () {
|
|
|
11586
11612
|
|
|
11587
11613
|
_classPrivateFieldSet(this, _player, null);
|
|
11588
11614
|
|
|
11615
|
+
this.socketTimer && clearTimeout(this.socketTimer);
|
|
11589
11616
|
(_this$socket2 = this.socket) === null || _this$socket2 === void 0 ? void 0 : _this$socket2.closeSocket(1000, '通知关闭websocket连接');
|
|
11590
11617
|
this.socket = null;
|
|
11591
11618
|
|
|
@@ -11600,12 +11627,12 @@ var common_request_wsClass = /*#__PURE__*/function () {
|
|
|
11600
11627
|
return wsClass;
|
|
11601
11628
|
}();
|
|
11602
11629
|
|
|
11603
|
-
var useKUcservice = function useKUcservice(options,
|
|
11604
|
-
var onOpen =
|
|
11605
|
-
onClose =
|
|
11606
|
-
onMessage =
|
|
11607
|
-
onError =
|
|
11608
|
-
initAction =
|
|
11630
|
+
var useKUcservice = function useKUcservice(options, _ref4) {
|
|
11631
|
+
var onOpen = _ref4.onOpen,
|
|
11632
|
+
onClose = _ref4.onClose,
|
|
11633
|
+
onMessage = _ref4.onMessage,
|
|
11634
|
+
onError = _ref4.onError,
|
|
11635
|
+
initAction = _ref4.initAction;
|
|
11609
11636
|
if (!window.WebSocket) return console.error('您的浏览器不支持WebSocket, 请更换浏览器!');
|
|
11610
11637
|
return new common_request_wsClass(options, {
|
|
11611
11638
|
onOpen: onOpen,
|
|
Binary file
|