2885213a7ffce24845df5ac7788b316880b4c51c.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. System.register(["__unresolved_0", "cc", "__unresolved_1"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, error, warn, Logger, NetNode, _crd, NetNodeStateStrs, NetTipsType, NetNodeState;
  4. function _reportPossibleCrUseOfLogger(extras) {
  5. _reporterNs.report("Logger", "../../core/common/log/Logger", _context.meta, extras);
  6. }
  7. function _reportPossibleCrUseOfCallbackObject(extras) {
  8. _reporterNs.report("CallbackObject", "./NetInterface", _context.meta, extras);
  9. }
  10. function _reportPossibleCrUseOfINetworkTips(extras) {
  11. _reporterNs.report("INetworkTips", "./NetInterface", _context.meta, extras);
  12. }
  13. function _reportPossibleCrUseOfIProtocolHelper(extras) {
  14. _reporterNs.report("IProtocolHelper", "./NetInterface", _context.meta, extras);
  15. }
  16. function _reportPossibleCrUseOfIRequestProtocol(extras) {
  17. _reporterNs.report("IRequestProtocol", "./NetInterface", _context.meta, extras);
  18. }
  19. function _reportPossibleCrUseOfISocket(extras) {
  20. _reporterNs.report("ISocket", "./NetInterface", _context.meta, extras);
  21. }
  22. function _reportPossibleCrUseOfNetCallFunc(extras) {
  23. _reporterNs.report("NetCallFunc", "./NetInterface", _context.meta, extras);
  24. }
  25. function _reportPossibleCrUseOfNetData(extras) {
  26. _reporterNs.report("NetData", "./NetInterface", _context.meta, extras);
  27. }
  28. function _reportPossibleCrUseOfRequestObject(extras) {
  29. _reporterNs.report("RequestObject", "./NetInterface", _context.meta, extras);
  30. }
  31. _export("NetNode", void 0);
  32. return {
  33. setters: [function (_unresolved_) {
  34. _reporterNs = _unresolved_;
  35. }, function (_cc) {
  36. _cclegacy = _cc.cclegacy;
  37. __checkObsolete__ = _cc.__checkObsolete__;
  38. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  39. error = _cc.error;
  40. warn = _cc.warn;
  41. }, function (_unresolved_2) {
  42. Logger = _unresolved_2.Logger;
  43. }],
  44. execute: function () {
  45. _crd = true;
  46. _cclegacy._RF.push({}, "57f0fB90kNBUJ98yyu+jxjx", "NetNode", undefined);
  47. __checkObsolete__(['error', 'warn']);
  48. /*
  49. * CocosCreator网络节点基类,以及网络相关接口定义
  50. * 1. 网络连接、断开、请求发送、数据接收等基础功能
  51. * 2. 心跳机制
  52. * 3. 断线重连 + 请求重发
  53. * 4. 调用网络屏蔽层
  54. */
  55. NetNodeStateStrs = ["已关闭", "连接中", "验证中", "可传输数据"];
  56. /** 网络提示类型枚举 */
  57. _export("NetTipsType", NetTipsType = /*#__PURE__*/function (NetTipsType) {
  58. NetTipsType[NetTipsType["Connecting"] = 0] = "Connecting";
  59. NetTipsType[NetTipsType["ReConnecting"] = 1] = "ReConnecting";
  60. NetTipsType[NetTipsType["Requesting"] = 2] = "Requesting";
  61. return NetTipsType;
  62. }({}));
  63. /** 网络状态枚举 */
  64. _export("NetNodeState", NetNodeState = /*#__PURE__*/function (NetNodeState) {
  65. NetNodeState[NetNodeState["Closed"] = 0] = "Closed";
  66. NetNodeState[NetNodeState["Connecting"] = 1] = "Connecting";
  67. NetNodeState[NetNodeState["Checking"] = 2] = "Checking";
  68. NetNodeState[NetNodeState["Working"] = 3] = "Working";
  69. return NetNodeState;
  70. }({}));
  71. /** 网络连接参数 */
  72. /** 网络节点 */
  73. _export("NetNode", NetNode = class NetNode {
  74. constructor() {
  75. this._connectOptions = null;
  76. this._autoReconnect = 0;
  77. this._isSocketInit = false;
  78. // Socket是否初始化过
  79. this._isSocketOpen = false;
  80. // Socket是否连接成功过
  81. this._state = NetNodeState.Closed;
  82. // 节点当前状态
  83. this._socket = null;
  84. // Socket对象(可能是原生socket、websocket、wx.socket...)
  85. this._networkTips = null;
  86. // 网络提示ui对象(请求提示、断线重连提示等)
  87. this._protocolHelper = null;
  88. // 包解析对象
  89. this._connectedCallback = null;
  90. // 连接完成回调
  91. this._disconnectCallback = null;
  92. // 断线回调
  93. this._callbackExecuter = null;
  94. // 回调执行
  95. this._keepAliveTimer = null;
  96. // 心跳定时器
  97. this._receiveMsgTimer = null;
  98. // 接收数据定时器
  99. this._reconnectTimer = null;
  100. // 重连定时器
  101. this._heartTime = 10000;
  102. // 心跳间隔
  103. this._receiveTime = 6000000;
  104. // 多久没收到数据断开
  105. this._reconnetTimeOut = 8000000;
  106. // 重连间隔
  107. this._requests = Array();
  108. // 请求列表
  109. this._listener = {};
  110. }
  111. // 监听者列表
  112. /********************** 网络相关处理 *********************/
  113. init(socket, protocol, networkTips, execFunc) {
  114. if (networkTips === void 0) {
  115. networkTips = null;
  116. }
  117. if (execFunc === void 0) {
  118. execFunc = null;
  119. }
  120. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  121. error: Error()
  122. }), Logger) : Logger).logNet("\u7F51\u7EDC\u521D\u59CB\u5316");
  123. this._socket = socket;
  124. this._protocolHelper = protocol;
  125. this._networkTips = networkTips;
  126. this._callbackExecuter = execFunc ? execFunc : (callback, buffer) => {
  127. callback.callback.call(callback.target, buffer);
  128. };
  129. }
  130. /**
  131. * 请求连接服务器
  132. * @param options 连接参数
  133. */
  134. connect(options) {
  135. if (this._socket && this._state == NetNodeState.Closed) {
  136. if (!this._isSocketInit) {
  137. this.initSocket();
  138. }
  139. this._state = NetNodeState.Connecting;
  140. if (!this._socket.connect(options)) {
  141. this.updateNetTips(NetTipsType.Connecting, false);
  142. return false;
  143. }
  144. if (this._connectOptions == null && typeof options.autoReconnect == "number") {
  145. this._autoReconnect = options.autoReconnect;
  146. }
  147. this._connectOptions = options;
  148. this.updateNetTips(NetTipsType.Connecting, true);
  149. return true;
  150. }
  151. return false;
  152. }
  153. initSocket() {
  154. if (this._socket) {
  155. this._socket.onConnected = event => {
  156. this.onConnected(event);
  157. };
  158. this._socket.onMessage = msg => {
  159. this.onMessage(msg);
  160. };
  161. this._socket.onError = event => {
  162. this.onError(event);
  163. };
  164. this._socket.onClosed = event => {
  165. this.onClosed(event);
  166. };
  167. this._isSocketInit = true;
  168. }
  169. }
  170. updateNetTips(tipsType, isShow) {
  171. if (this._networkTips) {
  172. if (tipsType == NetTipsType.Requesting) {
  173. this._networkTips.requestTips(isShow);
  174. } else if (tipsType == NetTipsType.Connecting) {
  175. this._networkTips.connectTips(isShow);
  176. } else if (tipsType == NetTipsType.ReConnecting) {
  177. this._networkTips.reconnectTips(isShow);
  178. }
  179. }
  180. }
  181. /** 网络连接成功 */
  182. onConnected(event) {
  183. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  184. error: Error()
  185. }), Logger) : Logger).logNet("网络已连接");
  186. this._isSocketOpen = true; // 如果设置了鉴权回调,在连接完成后进入鉴权阶段,等待鉴权结束
  187. if (this._connectedCallback !== null) {
  188. this._state = NetNodeState.Checking;
  189. this._connectedCallback(() => {
  190. this.onChecked();
  191. });
  192. } else {
  193. this.onChecked();
  194. }
  195. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  196. error: Error()
  197. }), Logger) : Logger).logNet("\u7F51\u7EDC\u5DF2\u8FDE\u63A5\u5F53\u524D\u72B6\u6001\u4E3A\u3010" + NetNodeStateStrs[this._state] + "\u3011");
  198. }
  199. /** 连接验证成功,进入工作状态 */
  200. onChecked() {
  201. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  202. error: Error()
  203. }), Logger) : Logger).logNet("连接验证成功,进入工作状态");
  204. this._state = NetNodeState.Working; // 关闭连接或重连中的状态显示
  205. this.updateNetTips(NetTipsType.Connecting, false);
  206. this.updateNetTips(NetTipsType.ReConnecting, false); // 重发待发送信息
  207. var requests = this._requests.concat();
  208. if (requests.length > 0) {
  209. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  210. error: Error()
  211. }), Logger) : Logger).logNet("\u8BF7\u6C42\u3010" + this._requests.length + "\u3011\u4E2A\u5F85\u53D1\u9001\u7684\u4FE1\u606F");
  212. for (var i = 0; i < requests.length;) {
  213. var req = requests[i];
  214. this._socket.send(req.buffer);
  215. if (req.rspObject == null || req.rspCmd != "") {
  216. requests.splice(i, 1);
  217. } else {
  218. ++i;
  219. }
  220. } // 如果还有等待返回的请求,启动网络请求层
  221. this.updateNetTips(NetTipsType.Requesting, this._requests.length > 0);
  222. }
  223. }
  224. /** 接收到一个完整的消息包 */
  225. onMessage(msg) {
  226. // Logger.logNet(`接受消息状态为【${NetNodeStateStrs[this._state]}】`);
  227. var json = JSON.parse(msg); // 进行头部的校验(实际包长与头部长度是否匹配)
  228. if (!this._protocolHelper.checkResponsePackage(json)) {
  229. error("\u6821\u9A8C\u63A5\u53D7\u6D88\u606F\u6570\u636E\u5F02\u5E38");
  230. return;
  231. } // 处理相应包数据
  232. if (!this._protocolHelper.handlerResponsePackage(json)) {
  233. if (this._networkTips) this._networkTips.responseErrorCode(json.code);
  234. } // 接受到数据,重新定时收数据计时器
  235. this.resetReceiveMsgTimer(); // 重置心跳包发送器
  236. this.resetHearbeatTimer(); // 触发消息执行
  237. var rspCmd = this._protocolHelper.getPackageId(json);
  238. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  239. error: Error()
  240. }), Logger) : Logger).logNet("\u63A5\u53D7\u5230\u547D\u4EE4\u3010" + rspCmd + "\u3011\u7684\u6D88\u606F"); // 优先触发request队列
  241. if (this._requests.length > 0) {
  242. for (var reqIdx in this._requests) {
  243. var req = this._requests[reqIdx];
  244. if (req.rspCmd == rspCmd && req.rspObject) {
  245. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  246. error: Error()
  247. }), Logger) : Logger).logNet("\u89E6\u53D1\u8BF7\u6C42\u547D\u4EE4\u3010" + rspCmd + "\u3011\u7684\u56DE\u8C03");
  248. this._callbackExecuter(req.rspObject, json.data);
  249. this._requests.splice(parseInt(reqIdx), 1);
  250. break;
  251. }
  252. }
  253. if (this._requests.length == 0) {
  254. this.updateNetTips(NetTipsType.Requesting, false);
  255. } else {
  256. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  257. error: Error()
  258. }), Logger) : Logger).logNet("\u8BF7\u6C42\u961F\u5217\u4E2D\u8FD8\u6709\u3010" + this._requests.length + "\u3011\u4E2A\u8BF7\u6C42\u5728\u7B49\u5F85");
  259. }
  260. }
  261. var listeners = this._listener[rspCmd];
  262. if (null != listeners) {
  263. for (var rsp of listeners) {
  264. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  265. error: Error()
  266. }), Logger) : Logger).logNet("\u89E6\u53D1\u76D1\u542C\u547D\u4EE4\u3010" + rspCmd + "\u3011\u7684\u56DE\u8C03");
  267. this._callbackExecuter(rsp, json.data);
  268. }
  269. }
  270. }
  271. onError(event) {
  272. error(event);
  273. }
  274. onClosed(event) {
  275. this.clearTimer(); // 执行断线回调,返回false表示不进行重连
  276. if (this._disconnectCallback && !this._disconnectCallback()) {
  277. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  278. error: Error()
  279. }), Logger) : Logger).logNet("\u65AD\u5F00\u8FDE\u63A5");
  280. return;
  281. } // 自动重连
  282. if (this.isAutoReconnect()) {
  283. this.updateNetTips(NetTipsType.ReConnecting, true);
  284. this._reconnectTimer = setTimeout(() => {
  285. this._socket.close();
  286. this._state = NetNodeState.Closed;
  287. this.connect(this._connectOptions);
  288. if (this._autoReconnect > 0) {
  289. this._autoReconnect -= 1;
  290. }
  291. }, this._reconnetTimeOut);
  292. } else {
  293. this._state = NetNodeState.Closed;
  294. }
  295. }
  296. /**
  297. * 断开网络
  298. * @param code 关闭码
  299. * @param reason 关闭原因
  300. */
  301. close(code, reason) {
  302. this.clearTimer();
  303. this._listener = {};
  304. this._requests.length = 0;
  305. if (this._networkTips) {
  306. this._networkTips.connectTips(false);
  307. this._networkTips.reconnectTips(false);
  308. this._networkTips.requestTips(false);
  309. }
  310. if (this._socket) {
  311. this._socket.close(code, reason);
  312. } else {
  313. this._state = NetNodeState.Closed;
  314. }
  315. }
  316. /**
  317. * 只是关闭Socket套接字(仍然重用缓存与当前状态)
  318. * @param code 关闭码
  319. * @param reason 关闭原因
  320. */
  321. closeSocket(code, reason) {
  322. if (this._socket) {
  323. this._socket.close(code, reason);
  324. }
  325. }
  326. /**
  327. * 发起请求,如果当前处于重连中,进入缓存列表等待重连完成后发送
  328. * @param buf 网络数据
  329. * @param force 是否强制发送
  330. */
  331. send(buf, force) {
  332. if (force === void 0) {
  333. force = false;
  334. }
  335. if (this._state == NetNodeState.Working || force) {
  336. return this._socket.send(buf);
  337. } else if (this._state == NetNodeState.Checking || this._state == NetNodeState.Connecting) {
  338. this._requests.push({
  339. buffer: buf,
  340. rspCmd: "",
  341. rspObject: null
  342. });
  343. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  344. error: Error()
  345. }), Logger) : Logger).logNet("\u5F53\u524D\u72B6\u6001\u4E3A\u3010" + NetNodeStateStrs[this._state] + "\u3011,\u7E41\u5FD9\u5E76\u7F13\u51B2\u53D1\u9001\u6570\u636E");
  346. return 0;
  347. } else {
  348. error("\u5F53\u524D\u72B6\u6001\u4E3A\u3010" + NetNodeStateStrs[this._state] + "\u3011,\u8BF7\u6C42\u9519\u8BEF");
  349. return -1;
  350. }
  351. }
  352. /**
  353. * 发起请求,并进入缓存列表
  354. * @param reqProtocol 请求协议
  355. * @param rspObject 回调对象
  356. * @param showTips 是否触发请求提示
  357. * @param force 是否强制发送
  358. */
  359. request(reqProtocol, rspObject, showTips, force) {
  360. if (showTips === void 0) {
  361. showTips = true;
  362. }
  363. if (force === void 0) {
  364. force = false;
  365. }
  366. var rspCmd = this._protocolHelper.handlerRequestPackage(reqProtocol);
  367. this.base_request(reqProtocol, rspCmd, rspObject, showTips, force);
  368. }
  369. /**
  370. * 唯一request,确保没有同一响应的请求(避免一个请求重复发送,netTips界面的屏蔽也是一个好的方法)
  371. * @param reqProtocol 请求协议
  372. * @param rspObject 回调对象
  373. * @param showTips 是否触发请求提示
  374. * @param force 是否强制发送
  375. */
  376. requestUnique(reqProtocol, rspObject, showTips, force) {
  377. if (showTips === void 0) {
  378. showTips = true;
  379. }
  380. if (force === void 0) {
  381. force = false;
  382. }
  383. var rspCmd = this._protocolHelper.handlerRequestPackage(reqProtocol);
  384. for (var i = 0; i < this._requests.length; ++i) {
  385. if (this._requests[i].rspCmd == rspCmd) {
  386. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  387. error: Error()
  388. }), Logger) : Logger).logNet("\u547D\u4EE4\u3010" + rspCmd + "\u3011\u91CD\u590D\u8BF7\u6C42");
  389. return false;
  390. }
  391. }
  392. this.base_request(reqProtocol, rspCmd, rspObject, showTips, force);
  393. return true;
  394. }
  395. base_request(reqProtocol, rspCmd, rspObject, showTips, force) {
  396. if (showTips === void 0) {
  397. showTips = true;
  398. }
  399. if (force === void 0) {
  400. force = false;
  401. }
  402. var buf = JSON.stringify(reqProtocol); // 转为二进制流发送
  403. if (this._state == NetNodeState.Working || force) {
  404. this._socket.send(buf);
  405. }
  406. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  407. error: Error()
  408. }), Logger) : Logger).logNet("\u961F\u5217\u547D\u4EE4\u4E3A\u3010" + rspCmd + "\u3011\u7684\u8BF7\u6C42\uFF0C\u7B49\u5F85\u8BF7\u6C42\u6570\u636E\u7684\u56DE\u8C03"); // 进入发送缓存列表
  409. this._requests.push({
  410. buffer: buf,
  411. rspCmd,
  412. rspObject
  413. }); // 启动网络请求层
  414. if (showTips) {
  415. this.updateNetTips(NetTipsType.Requesting, true);
  416. }
  417. }
  418. /********************** 回调相关处理 *********************/
  419. /**
  420. * 设置一个唯一的服务器推送监听
  421. * @param cmd 命令字串
  422. * @param callback 回调方法
  423. * @param target 目标对象
  424. */
  425. setResponeHandler(cmd, callback, target) {
  426. if (callback == null) {
  427. error("\u547D\u4EE4\u4E3A\u3010" + cmd + "\u3011\u8BBE\u7F6E\u54CD\u5E94\u5904\u7406\u7A0B\u5E8F\u9519\u8BEF");
  428. return false;
  429. }
  430. this._listener[cmd] = [{
  431. target,
  432. callback
  433. }];
  434. return true;
  435. }
  436. /**
  437. * 可添加多个同类返回消息的监听
  438. * @param cmd 命令字串
  439. * @param callback 回调方法
  440. * @param target 目标对象
  441. * @returns
  442. */
  443. addResponeHandler(cmd, callback, target) {
  444. if (callback == null) {
  445. error("\u547D\u4EE4\u4E3A\u3010" + cmd + "\u3011\u6DFB\u52A0\u54CD\u5E94\u5904\u7406\u7A0B\u5E8F\u9519\u8BEF");
  446. return false;
  447. }
  448. var rspObject = {
  449. target,
  450. callback
  451. };
  452. if (null == this._listener[cmd]) {
  453. this._listener[cmd] = [rspObject];
  454. } else {
  455. var index = this.getNetListenersIndex(cmd, rspObject);
  456. if (-1 == index) {
  457. this._listener[cmd].push(rspObject);
  458. }
  459. }
  460. return true;
  461. }
  462. /**
  463. * 删除一个监听中指定子回调
  464. * @param cmd 命令字串
  465. * @param callback 回调方法
  466. * @param target 目标对象
  467. */
  468. removeResponeHandler(cmd, callback, target) {
  469. if (null != this._listener[cmd] && callback != null) {
  470. var index = this.getNetListenersIndex(cmd, {
  471. target,
  472. callback
  473. });
  474. if (-1 != index) {
  475. this._listener[cmd].splice(index, 1);
  476. }
  477. }
  478. }
  479. /**
  480. * 清除所有监听或指定命令的监听
  481. * @param cmd 命令字串(默认不填为清除所有)
  482. */
  483. cleanListeners(cmd) {
  484. if (cmd === void 0) {
  485. cmd = "";
  486. }
  487. if (cmd == "") {
  488. this._listener = {};
  489. } else {
  490. delete this._listener[cmd];
  491. }
  492. }
  493. getNetListenersIndex(cmd, rspObject) {
  494. var index = -1;
  495. for (var i = 0; i < this._listener[cmd].length; i++) {
  496. var iterator = this._listener[cmd][i];
  497. if (iterator.callback == rspObject.callback && iterator.target == rspObject.target) {
  498. index = i;
  499. break;
  500. }
  501. }
  502. return index;
  503. }
  504. /********************** 心跳、超时相关处理 *********************/
  505. resetReceiveMsgTimer() {
  506. if (this._receiveMsgTimer !== null) {
  507. clearTimeout(this._receiveMsgTimer);
  508. }
  509. this._receiveMsgTimer = setTimeout(() => {
  510. warn("接收消息定时器关闭网络连接");
  511. this._socket.close();
  512. }, this._receiveTime);
  513. }
  514. resetHearbeatTimer() {
  515. if (this._keepAliveTimer !== null) {
  516. clearTimeout(this._keepAliveTimer);
  517. }
  518. this._keepAliveTimer = setTimeout(() => {
  519. (_crd && Logger === void 0 ? (_reportPossibleCrUseOfLogger({
  520. error: Error()
  521. }), Logger) : Logger).logNet("网络节点保持活跃发送心跳信息");
  522. this.send(this._protocolHelper.getHearbeat());
  523. }, this._heartTime);
  524. }
  525. clearTimer() {
  526. if (this._receiveMsgTimer !== null) {
  527. clearTimeout(this._receiveMsgTimer);
  528. }
  529. if (this._keepAliveTimer !== null) {
  530. clearTimeout(this._keepAliveTimer);
  531. }
  532. if (this._reconnectTimer !== null) {
  533. clearTimeout(this._reconnectTimer);
  534. }
  535. }
  536. /** 是否自动重连接 */
  537. isAutoReconnect() {
  538. return this._autoReconnect != 0;
  539. }
  540. /** 拒绝重新连接 */
  541. rejectReconnect() {
  542. this._autoReconnect = 0;
  543. this.clearTimer();
  544. }
  545. });
  546. _cclegacy._RF.pop();
  547. _crd = false;
  548. }
  549. };
  550. });
  551. //# sourceMappingURL=2885213a7ffce24845df5ac7788b316880b4c51c.js.map