Эх сурвалжийг харах

确保音频websocket被关闭

Michael Wang 6 жил өмнө
parent
commit
a8d4235f17

+ 5 - 1
src/features/OnlineExam/Examing/ws.js

@@ -88,7 +88,11 @@ function heartbeat() {
 
 export function closeWsWithoutReconnect() {
   shouldReconnect = false;
-  ws.close();
+  try {
+    if (ws && ws.readyState === 1) ws.close();
+  } catch (e) {
+    console.log("关闭ws异常。");
+  }
 }
 
 export function getQRCode(order) {