fix(sse): buffer session events for late subscribers + clear on close
The Pi process produces events immediately after session creation, but the browser's SSE connection may not be open yet (React re-render delay, navigation). The hub discarded events with no subscribers, so the user saw a blank session. - Ring-buffer up to 200 events per session; replay on subscribe - hub.clear(id) on POST /sessions/:id/close frees memory
This commit is contained in:
@@ -62,7 +62,9 @@ export function sessionRoutes(
|
||||
return reply.code(200).send({ id });
|
||||
});
|
||||
app.post("/sessions/:id/close", async (req) => {
|
||||
d.mgr.teardown((req.params as any).id);
|
||||
const id = (req.params as { id: string }).id;
|
||||
d.mgr.teardown(id);
|
||||
d.hub.clear(id);
|
||||
return { closed: true };
|
||||
});
|
||||
app.get("/sessions/:id/events", (req, reply) => {
|
||||
|
||||
Reference in New Issue
Block a user