Przeglądaj źródła

确保音频websocket被关闭

Michael Wang 6 lat temu
rodzic
commit
a8d4235f17
1 zmienionych plików z 5 dodań i 1 usunięć
  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) {