From aaf23343ac97701254c1f0ca011d1b1dc8011128 Mon Sep 17 00:00:00 2001 From: GYJ <1157756119@qq.com> Date: Mon, 17 Jun 2024 17:24:14 +0800 Subject: [PATCH] =?UTF-8?q?socket=20=E8=BF=9E=E6=8E=A5=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=97=B6close=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/js/websocket.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/js/websocket.js b/common/js/websocket.js index c9f3680..c0c1194 100644 --- a/common/js/websocket.js +++ b/common/js/websocket.js @@ -58,8 +58,9 @@ class webSocketUtils { // 监听连接失败,这里代码我注释掉的原因是因为如果服务器关闭后,和下面的onclose方法一起发起重连操作,这样会导致重复连接 uni.onSocketError((res) => { console.log('网络断开,请检查!'); - this.socketTask = null; - this.is_open_socket = false; + // this.socketTask = null; + // this.is_open_socket = false; + this.Close() this.canReconnect = true; clearInterval(this.heartbeatInterval); clearInterval(this.reconnectTimeOut);