Node.js presence leases expire ghost users after network drops instead of trusting disconnect events
The article argues that realtime presence indicators should be treated as short, expiring leases tied to a single authenticated editor session rather than facts erased by disconnect events. Network drops don't send a final message, so a server cannot rely on close or disconnect signals as the source of truth, and brief ghost users during an expiry window are expected behavior. Presence should be scoped per session with a random token limited to one document, user, and short expiry, so one tab's delayed close cannot erase another tab's healthy session. The author recommends keeping mention notifications, which are durable data, separate from cursor presence, which is temporary. Debugging should compare four timestamps on the server clock, and reconnects should issue a fresh session ID so stale packets cannot extend or delete new sessions.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in