/*
 * @Author: Z 1518051043@qq.com
 * @Date: 2025-12-01 13:52:20
 * @LastEditors: zwy 1518051043@qq.com
 * @LastEditTime: 2026-01-21 13:08:12
 * @FilePath: \yuanxinPro\src\utils\requestSocekt.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import ueHeartbeatInterval from '@/store/module/app.js'
import useAppStore from '@/store/module/app.js'
const useAppStoreInstance = useAppStore()
const apiUrl = `ws://121.229.107.155:19021/systemData`
// const apiUrl = `ws://127.0.0.1:19021/systemData`//本地地址

const SubWss = new WebSocket(apiUrl);
useAppStoreInstance.setSubsystemSocket(SubWss)
// SubWss.onclose = () => {
//   clearInterval(ueHeartbeatInterval);
//   //console.log('子星级WebSocket正在重新连接, attempting reconnect...');
//   setTimeout(() => {
//     // 自动重连逻辑
//    SubWss =  new WebSocket(apiUrl);
//     //console.log('子星级WebSocket...',SubWss);
//   }, 1000);
// };

export default SubWss;
