feat: implement SSE-based real-time event distribution system with replay support and heartbeat functionality

This commit is contained in:
2569718930@qq.com
2026-05-26 22:27:55 +08:00
parent 5c6ffa4742
commit 645e304b3e
20 changed files with 1449 additions and 119 deletions
+6 -1
View File
@@ -13,7 +13,12 @@ export async function GET(req: NextRequest) {
);
}
const upstream = await fetch(`${API_BASE.replace(/\/+$/, "")}/api/events`, {
const upstreamUrl = new URL(`${API_BASE.replace(/\/+$/, "")}/api/events`);
req.nextUrl.searchParams.forEach((value, key) => {
upstreamUrl.searchParams.append(key, value);
});
const upstream = await fetch(upstreamUrl.toString(), {
cache: "no-store",
headers: {
Accept: "text/event-stream",