1
This commit is contained in:
@@ -324,14 +324,29 @@ const SSEManager = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleError() {
|
handleError() {
|
||||||
|
console.log('=== SSE错误处理 ===')
|
||||||
|
console.log('准备断开并重连SSE')
|
||||||
this.disconnect()
|
this.disconnect()
|
||||||
setTimeout(() => this.connect(), 3000)
|
setTimeout(() => {
|
||||||
|
console.log('🔄 开始重连SSE')
|
||||||
|
this.connect()
|
||||||
|
}, 3000)
|
||||||
},
|
},
|
||||||
|
|
||||||
disconnect() {
|
disconnect() {
|
||||||
if (this.connection) {
|
if (this.connection) {
|
||||||
try { this.connection.close() } catch {}
|
console.log('=== SSE断开连接 ===')
|
||||||
|
console.log('断开连接URL:', this.connection.url)
|
||||||
|
console.log('断开前状态:', this.connection.readyState)
|
||||||
|
try {
|
||||||
|
this.connection.close()
|
||||||
|
console.log('✅ SSE连接已主动关闭')
|
||||||
|
} catch (e) {
|
||||||
|
console.log('❌ SSE关闭时出错:', e.message)
|
||||||
|
}
|
||||||
this.connection = null
|
this.connection = null
|
||||||
|
} else {
|
||||||
|
console.log('⚠️ 尝试断开SSE,但连接不存在')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user