export default function handler(req: NextApiRequest, res: NextApiResponse) {
res.writeHead(200, {
Connection: "keep-alive",
"Cache-Control": "no-cache, no-transform",
"Content-Encoding": "none",
"Content-Type": "text/event-stream",
});
for (let i = 1; i <= 2000; i += 1) {
const val = Math.random();
res.write("data: " + i + " " + val + "\n\n");
}
}
export default function handler(req: NextApiRequest, res: NextApiResponse) {
res.writeHead(200, {
Connection: "keep-alive",
"Cache-Control": "no-cache, no-transform",
"Content-Encoding": "none",
"Content-Type": "text/event-stream",
});
for (let i = 1; i <= 2000; i += 1) {
const val = Math.random();
res.write("data: " + i + " " + val + "\n\n");
}
}