import type {Context} from "hono"; import {db} from "../../../../database/dbclient.js"; import {and, eq, gt} from "drizzle-orm"; import {streamSSE} from "hono/streaming"; import {logs} from "../../../../database/schema/logs.js"; export async function streamLogs(c: Context) { let id = 0; let running = true; // c.header("Content-Type", "text/event-stream"); // c.header("Cache-Control", "no-cache"); // c.header("Connection", "keep-alive"); const getLogs = async () => {}; return streamSSE(c, async (stream) => { while (running) { const message = `It is ${new Date().toISOString()}`; await stream.writeSSE({ data: message, event: "time-update", id: String(id++), }); await stream.sleep(1000); if (id === 5) { running = false; } } }); }