瀏覽代碼

优化:聊天监听到断网,则立即把连接状态标记为 false,让其发不了消息

shizhongqi 10 月之前
父節點
當前提交
d657d972f9
共有 2 個文件被更改,包括 8 次插入6 次删除
  1. 4 3
      hdApp/src/admin/chat/chatPage.vue
  2. 4 3
      mallApp/src/pages/chat/chatPage.vue

+ 4 - 3
hdApp/src/admin/chat/chatPage.vue

@@ -446,10 +446,11 @@ export default {
             }, 3000);
           }
 
+          this.isConnected = false;
           // 尝试重新连接超过 maxReconnectCount 次才标记为未连接状态
-          if (!this.isManualDisconnect && this.reconnectCount >= this.maxReconnectCount) {
-            this.isConnected = false;
-          }
+          // if (!this.isManualDisconnect && this.reconnectCount >= this.maxReconnectCount) {
+          //   this.isConnected = false;
+          // }
         });
 
         // 监听WebSocket错误

+ 4 - 3
mallApp/src/pages/chat/chatPage.vue

@@ -530,10 +530,11 @@ export default {
             }, 3000);
           }
 
+          this.isConnected = false;
           // 尝试重新连接超过 maxReconnectCount 次才标记为未连接状态
-          if (!this.isManualDisconnect && this.reconnectCount >= this.maxReconnectCount) {
-            this.isConnected = false;
-          }
+          // if (!this.isManualDisconnect && this.reconnectCount >= this.maxReconnectCount) {
+          //   this.isConnected = false;
+          // }
         });
 
         // 监听WebSocket错误