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.
@@ -2078,7 +2078,7 @@ var es_json_stringify = __webpack_require__("e9c4");
2078
2078
  var EventTypes = ['open', 'close', 'message', 'error', 'reconnect'];
2079
2079
  var DEFAULT_CHECK_TIME = 30 * 1000; // 心跳检测的默认时间
2080
2080
 
2081
- var TIMEOUT = 40 * 1000; //重连延迟时间
2081
+ var TIMEOUT = 100; //重连延迟时间
2082
2082
 
2083
2083
  var DEFAULT_CHECK_COUNT = 10; // 心跳检测默认失败重连次数
2084
2084
 
@@ -11476,12 +11476,10 @@ var _phoneClientObj = /*#__PURE__*/new WeakMap();
11476
11476
 
11477
11477
  var common_request_wsClass = /*#__PURE__*/function () {
11478
11478
  function wsClass(config, _ref2) {
11479
- var _this = this;
11480
-
11481
- var _onOpen = _ref2.onOpen,
11482
- _onClose = _ref2.onClose,
11483
- _onMessage = _ref2.onMessage,
11484
- _onError = _ref2.onError,
11479
+ var onOpen = _ref2.onOpen,
11480
+ onClose = _ref2.onClose,
11481
+ onMessage = _ref2.onMessage,
11482
+ onError = _ref2.onError,
11485
11483
  initAction = _ref2.initAction;
11486
11484
 
11487
11485
  Object(classCallCheck["a" /* default */])(this, wsClass);
@@ -11502,41 +11500,67 @@ var common_request_wsClass = /*#__PURE__*/function () {
11502
11500
  checkData: JSON.stringify(GetSendModel('keeplive', this.config))
11503
11501
  });
11504
11502
  this.socket = common_request_useRequest('websocket')(config, this);
11505
- initWsBaseTheme(this.socket, {
11506
- onOpen: function onOpen(e) {
11507
- // 登录
11508
- console.log('====onOpen=====');
11509
- console.log(_this);
11510
-
11511
- _this.send('Login');
11512
-
11513
- _onOpen && _onOpen(e);
11514
- },
11515
- onClose: function onClose(e) {
11516
- _onClose && _onClose(e);
11517
- },
11518
- onMessage: function onMessage(e) {
11519
- var data = e.data || e;
11520
-
11521
- if (data.indexOf('Back_Login(') === 0) {
11522
- // 设置坐席
11523
- _this.config.AgentGroupName && _this.send("SetGroupRole", _this.config.AgentGroupName); // 初始化操作
11524
-
11525
- initAction && initAction(); // return
11526
- }
11527
-
11528
- _onMessage && _onMessage(e);
11529
- },
11530
- onError: function onError(e) {
11531
- _onError && _onError(e);
11532
- },
11533
- onReconnect: function onReconnect(e) {
11534
- _this.scoket = e;
11535
- }
11503
+ this.initSocket({
11504
+ onOpen: onOpen,
11505
+ onClose: onClose,
11506
+ onMessage: onMessage,
11507
+ onError: onError,
11508
+ initAction: initAction
11536
11509
  });
11537
11510
  }
11538
11511
 
11539
11512
  Object(createClass["a" /* default */])(wsClass, [{
11513
+ key: "initSocket",
11514
+ value: function initSocket(_ref3) {
11515
+ var _this = this;
11516
+
11517
+ var _onOpen = _ref3.onOpen,
11518
+ _onClose = _ref3.onClose,
11519
+ _onMessage = _ref3.onMessage,
11520
+ _onError = _ref3.onError,
11521
+ initAction = _ref3.initAction;
11522
+ initWsBaseTheme(this.socket, {
11523
+ onOpen: function onOpen(e) {
11524
+ // 登录
11525
+ console.log('====onOpen=====');
11526
+ console.log(_this);
11527
+
11528
+ _this.send('Login');
11529
+
11530
+ _onOpen && _onOpen(e);
11531
+ },
11532
+ onClose: function onClose(e) {
11533
+ _onClose && _onClose(e);
11534
+ },
11535
+ onMessage: function onMessage(e) {
11536
+ var data = e.data || e;
11537
+
11538
+ if (data.indexOf('Back_Login(') === 0) {
11539
+ // 设置坐席
11540
+ _this.config.AgentGroupName && _this.send("SetGroupRole", _this.config.AgentGroupName); // 初始化操作
11541
+
11542
+ initAction && initAction(); // return
11543
+ }
11544
+
11545
+ _onMessage && _onMessage(e);
11546
+ },
11547
+ onError: function onError(e) {
11548
+ _onError && _onError(e);
11549
+ },
11550
+ onReconnect: function onReconnect(e) {
11551
+ _this.scoket = e;
11552
+
11553
+ _this.initSocket({
11554
+ onOpen: _onOpen,
11555
+ onClose: _onClose,
11556
+ onMessage: _onMessage,
11557
+ onError: _onError,
11558
+ initAction: initAction
11559
+ });
11560
+ }
11561
+ });
11562
+ }
11563
+ }, {
11540
11564
  key: "send",
11541
11565
  value: function send(action, params) {
11542
11566
  var _this$socket;
@@ -11594,12 +11618,12 @@ var common_request_wsClass = /*#__PURE__*/function () {
11594
11618
  return wsClass;
11595
11619
  }();
11596
11620
 
11597
- var useKUcservice = function useKUcservice(options, _ref3) {
11598
- var onOpen = _ref3.onOpen,
11599
- onClose = _ref3.onClose,
11600
- onMessage = _ref3.onMessage,
11601
- onError = _ref3.onError,
11602
- initAction = _ref3.initAction;
11621
+ var useKUcservice = function useKUcservice(options, _ref4) {
11622
+ var onOpen = _ref4.onOpen,
11623
+ onClose = _ref4.onClose,
11624
+ onMessage = _ref4.onMessage,
11625
+ onError = _ref4.onError,
11626
+ initAction = _ref4.initAction;
11603
11627
  if (!window.WebSocket) return console.error('您的浏览器不支持WebSocket, 请更换浏览器!');
11604
11628
  return new common_request_wsClass(options, {
11605
11629
  onOpen: onOpen,
Binary file