email: push new-mail to /email via SSE (IMAP IDLE -> sidecar -> server -> EventSource)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 17:29:20 +00:00
co-authored by Claude Opus 4.8
parent 5a0b9ce70f
commit 4b08d0b99c
6 changed files with 93 additions and 4 deletions
+3 -2
View File
@@ -85,8 +85,9 @@ const connection = createSidecarConnector({
onConnected() {
// Start email cron once connected (so queue commands can reach API server)
initEmailCron();
// Real-time push via IMAP IDLE; the cron above is the slow backstop.
initEmailIdle();
// Real-time push via IMAP IDLE; the cron above is the slow backstop. On new mail, tell the API
// server so it can push an SSE event to that user's open /email page.
initEmailIdle((userEmail) => connection.send({ type: 'email:new', userEmail }));
},
});