吉安感知网项目-前端
shuishen
2026-02-26 ae0398be3a751fd928d327f40ea4e68395813f1d
uniapps/work-app/src/utils/websocket.js
@@ -114,8 +114,8 @@
    this.socketTask.send({
      data: JSON.stringify(message),
      success: () => {
        // console.log('WebSocket消息发送成功:', message)
        useGlobalWS();
        console.log('WebSocket消息发送成功:', message)
        // useGlobalWS();
      },
      fail: (error) => {
        // console.error('WebSocket消息发送失败:', error)
@@ -124,15 +124,15 @@
  }
  // 开始心跳检测
  startPing() {
    this.stopPing()
    // 每25秒发送一次心跳
    this.pingTimer = setInterval(() => {
      if (this.connected) {
        this.send('ping', 'system')
      }
    }, 25000)
  }
  // startPing() {
  //   this.stopPing()
  //   // 每25秒发送一次心跳
  //   this.pingTimer = setInterval(() => {
  //     if (this.connected) {
  //       this.send('ping', 'system')
  //     }
  //   }, 25000)
  // }
  // 停止心跳检测
  stopPing() {