This commit is contained in:
yohlo
2025-09-25 16:42:55 -05:00
parent b3ebf46afa
commit 92c4987372
8 changed files with 1615 additions and 17 deletions

View File

@@ -695,6 +695,7 @@ import type { getRouter } from './router.tsx'
import type { createStart } from '@tanstack/react-start'
declare module '@tanstack/react-start' {
interface Register {
ssr: true
router: Awaited<ReturnType<typeof getRouter>>
}
}

View File

@@ -8,8 +8,6 @@ export const Route = createFileRoute("/api/events/$")({
middleware: [superTokensRequestMiddleware],
handlers: {
GET: ({ request, context }) => {
logger.info("ServerEvents | New connection", context?.userAuthId);
const stream = new ReadableStream({
start(controller) {
const connectMessage = `data: ${JSON.stringify({ type: "connected" })}\n\n`;
@@ -41,14 +39,6 @@ export const Route = createFileRoute("/api/events/$")({
const cleanup = () => {
serverEvents.off("test", handleEvent);
clearInterval(pingInterval);
try {
logger.info(
"ServerEvents | Closing connection",
context?.userAuthId
);
} catch (e) {
logger.error("ServerEvents | Error closing controller", e);
}
};
request.signal?.addEventListener("abort", cleanup);