feat: 请求失败关闭sse

This commit is contained in:
rd
2025-09-05 13:53:21 +08:00
parent a2401fc696
commit d7e1aecb38

View File

@ -70,15 +70,14 @@ export default async (config: SSEConfig, url: string = DEFAULT_SSE_URL): Promise
}
},
onerror(error: Error) {
// console.error('SSE error:', error);
// 请求失败时主动关闭SSE连接
abortController.abort();
handleError?.(error);
},
onclose() {
// console.log('SSE connection closed');
handleClose?.();
},
async onopen(response: Response) {
// console.log('onopen', response);
handleOpen?.(response);
},
});