UPDATE: 异步导出检测数据逻辑。
This commit is contained in:
@@ -211,13 +211,19 @@ class RequestHttp {
|
||||
const eventSource = new EventSourcePolyfill(requestUrl, {
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + userStore.accessToken
|
||||
}
|
||||
},
|
||||
// 增加超时时间到120秒
|
||||
heartbeatTimeout: 120000
|
||||
})
|
||||
|
||||
// 设置默认的Authorization头部
|
||||
eventSource.addEventListener('open', function () {
|
||||
console.log('SSE连接已建立')
|
||||
})
|
||||
// 添加错误处理
|
||||
eventSource.addEventListener('error', function (err) {
|
||||
console.error('SSE连接错误:', err)
|
||||
})
|
||||
|
||||
return eventSource
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user