feat(deploy): notify clients of new releases
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { connection } from "next/server";
|
||||
|
||||
import { normalizeDeploymentId } from "@/lib/deployment/version";
|
||||
import { createEventStream, eventStreamHeaders } from "@/lib/events/sse";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
await connection();
|
||||
const deploymentId =
|
||||
normalizeDeploymentId(process.env.NEXT_DEPLOYMENT_ID) ?? "development";
|
||||
const channel = createEventStream({ signal: request.signal });
|
||||
channel.sendNamed("deployment", deploymentId);
|
||||
|
||||
return new Response(channel.stream, {
|
||||
headers: eventStreamHeaders(),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user