Quellcode durchsuchen

feat(云机触控): 链接错误重连

zengzhixiang vor 2 Jahren
Ursprung
Commit
06a6c677ee
2 geänderte Dateien mit 11 neuen und 11 gelöschten Zeilen
  1. 6 6
      static/screenAndroid/WXdraw.js
  2. 5 5
      static/screenIos/WXdraw.js

+ 6 - 6
static/screenAndroid/WXdraw.js

@@ -69,12 +69,12 @@ function doConnectDirectives() {
       }),
     );
   };
-  wsss.onerror = function (evt) {
-    // wsss.close();
-    // throttle(doConnectDirectives, 100);
-    // if (errorTime > 1000) {
-    //   quit();
-    // }
+  wsss.onerror = function (e) {
+    wsss.close();
+    throttle(doConnectDirectives, 100);
+    if (errorTime > 1000) {
+      quit();
+    }
   };
   wsss.onclose = function (e) {
     // console.log('🚀 ~ file: WXdraw.js ~ line 93 ~ onclose ~ e', e.code);

+ 5 - 5
static/screenIos/WXdraw.js

@@ -80,11 +80,11 @@ function doConnectDirectives() {
   };
   wsss.onerror = function (e) {
     // console.log('🚀 ~ file: WXdraw.js ~ line 82 ~ onerror ~ e', e);
-    // wsss.close(1006);
-    // throttle(doConnectDirectives, 100);
-    // if (errorTime > 1000) {
-    //   quit();
-    // }
+    wsss.close();
+    throttle(doConnectDirectives, 100);
+    if (errorTime > 1000) {
+      quit();
+    }
   };
   wsss.onclose = function (e) {
     // console.log('🚀 ~ file: WXdraw.js ~ line 93 ~ onclose ~ e', e.code);