perf: sse

This commit is contained in:
archer
2023-08-07 18:04:50 +08:00
parent b142c04b95
commit 78906d8557

View File

@@ -83,6 +83,7 @@ export const sseResponse = ({
event?: string; event?: string;
data: string; data: string;
}) => { }) => {
if (res.closed) return;
event && res.write(`event: ${event}\n`); event && res.write(`event: ${event}\n`);
res.write(`data: ${data}\n\n`); res.write(`data: ${data}\n\n`);
}; };