Explorar o código

确保音频websocket被关闭

Michael Wang %!s(int64=6) %!d(string=hai) anos
pai
achega
a8d4235f17
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      src/features/OnlineExam/Examing/ws.js

+ 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) {