kucservice 1.4.8 → 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.
@@ -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 = 40 * 1000; //重连延迟时间
2090
+ var TIMEOUT = 100; //重连延迟时间
2091
2091
 
2092
2092
  var DEFAULT_CHECK_COUNT = 10; // 心跳检测默认失败重连次数
2093
2093
 
@@ -11485,12 +11485,10 @@ var _phoneClientObj = /*#__PURE__*/new WeakMap();
11485
11485
 
11486
11486
  var common_request_wsClass = /*#__PURE__*/function () {
11487
11487
  function wsClass(config, _ref2) {
11488
- var _this = this;
11489
-
11490
- var _onOpen = _ref2.onOpen,
11491
- _onClose = _ref2.onClose,
11492
- _onMessage = _ref2.onMessage,
11493
- _onError = _ref2.onError,
11488
+ var onOpen = _ref2.onOpen,
11489
+ onClose = _ref2.onClose,
11490
+ onMessage = _ref2.onMessage,
11491
+ onError = _ref2.onError,
11494
11492
  initAction = _ref2.initAction;
11495
11493
 
11496
11494
  Object(classCallCheck["a" /* default */])(this, wsClass);
@@ -11511,41 +11509,67 @@ var common_request_wsClass = /*#__PURE__*/function () {
11511
11509
  checkData: JSON.stringify(GetSendModel('keeplive', this.config))
11512
11510
  });
11513
11511
  this.socket = common_request_useRequest('websocket')(config, this);
11514
- initWsBaseTheme(this.socket, {
11515
- onOpen: function onOpen(e) {
11516
- // 登录
11517
- console.log('====onOpen=====');
11518
- console.log(_this);
11519
-
11520
- _this.send('Login');
11521
-
11522
- _onOpen && _onOpen(e);
11523
- },
11524
- onClose: function onClose(e) {
11525
- _onClose && _onClose(e);
11526
- },
11527
- onMessage: function onMessage(e) {
11528
- var data = e.data || e;
11529
-
11530
- if (data.indexOf('Back_Login(') === 0) {
11531
- // 设置坐席
11532
- _this.config.AgentGroupName && _this.send("SetGroupRole", _this.config.AgentGroupName); // 初始化操作
11533
-
11534
- initAction && initAction(); // return
11535
- }
11536
-
11537
- _onMessage && _onMessage(e);
11538
- },
11539
- onError: function onError(e) {
11540
- _onError && _onError(e);
11541
- },
11542
- onReconnect: function onReconnect(e) {
11543
- _this.scoket = e;
11544
- }
11512
+ this.initSocket({
11513
+ onOpen: onOpen,
11514
+ onClose: onClose,
11515
+ onMessage: onMessage,
11516
+ onError: onError,
11517
+ initAction: initAction
11545
11518
  });
11546
11519
  }
11547
11520
 
11548
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
+ }, {
11549
11573
  key: "send",
11550
11574
  value: function send(action, params) {
11551
11575
  var _this$socket;
@@ -11603,12 +11627,12 @@ var common_request_wsClass = /*#__PURE__*/function () {
11603
11627
  return wsClass;
11604
11628
  }();
11605
11629
 
11606
- var useKUcservice = function useKUcservice(options, _ref3) {
11607
- var onOpen = _ref3.onOpen,
11608
- onClose = _ref3.onClose,
11609
- onMessage = _ref3.onMessage,
11610
- onError = _ref3.onError,
11611
- initAction = _ref3.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;
11612
11636
  if (!window.WebSocket) return console.error('您的浏览器不支持WebSocket, 请更换浏览器!');
11613
11637
  return new common_request_wsClass(options, {
11614
11638
  onOpen: onOpen,
Binary file