Notifio is a desktop monitor for rental listings. Inside the Electron main process there is an Express server, the UI is a React app it serves over HTTP, and the renderer talks to it on 127.0.0.1 with no preload script and no IPC .
The live half of that is one server-sent events endpoint. It has an unusual constraint on it: the window reloads itself every single time it is opened from the tray . A fresh React tree, an empty store, no memory of the twelve hours the monitor spent working while the window was hidden.
A stream of changes is worthless to a client in that position. So the stream opens with the past:
app . get ( ' /api/events ' , ( req : Request , res : Response ) => { res . setHeader ( ' Content-Type ' , ' text/event-stream ' ); res . setHeader ( ' Cache-Control ' , ' no-cache ' ); res . setHeader ( ' Connection ' , ' keep-alive ' ); res .…