Kaynağa Gözat

feat(student): 添加WebSocket连接的超时和重连配置

在WebSocket连接参数中增加了30秒的连接超时时间和5秒的最大重连间隔,优化连接稳定性。
lsc 2 hafta önce
ebeveyn
işleme
621662ada8
1 değiştirilmiş dosya ile 5 ekleme ve 1 silme
  1. 5 1
      src/views/Student/index.vue

+ 5 - 1
src/views/Student/index.vue

@@ -4294,7 +4294,11 @@ const createWebSocketConnection = async (type = 1) => {
       api.yweb_socket,
       'PPT' + props.courseid,
       docSocket.value,
-      { params: { yauth: authToken.value } }
+      {
+        params: { yauth: authToken.value },
+        maxBackoffTime: 5000, // 重连最长等 5 秒
+        timeout: 30000 // 连接超时时间(30秒)
+      }
     )
     
     // 启动定期更新 token