zjj
2025-07-02 ab478c5acee01dc7fcd319c5715fc38b8342219c
Monitor-APP/pages/home/uniWebSocket.js
@@ -180,9 +180,9 @@
    // 清除之前的心跳定时器
    this.stopHeartbeat();
    
    // 设置新的心跳定时器
    // 设置新的心跳定时器,增加判断条件避免不必要的心跳
    this.heartbeatTimer = setInterval(() => {
      if (this.isConnected) {
      if (this.isConnected && this.socketTask && this.socketTask.readyState === 1) {
        console.log('WebSocket发送心跳');
        this.send(this.options.heartbeatMessage);
      }