bun
This commit is contained in:
@@ -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>>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user