Urgent.News

What's breaking now, across thousands of outlets.

Tech

Node.js Lease Presence Beats Disconnect Events After Realtime Network Drops

TL;DR: When realtime presence shows ghost users after a network drop, treat presence as a short lease owned by one newsroom editor session, not as a fact that a disconnect event must erase. A Node.js service should expire the lease unless the same authenticated session renews it. Disconnect events can speed up cleanup, but they can't be the source of truth. Keep in-app mention notifications…

The article discusses the issue of ghost users appearing in realtime presence after a network drop when using Node.js. The root cause of this problem is that servers typically detect graceful closures quickly, but network drops are different as the client cannot send a final message when connectivity is lost. This results in the client not being able to transmit a leave event, which can create the illusion of ghost users.

To address this issue, the article suggests treating presence as a short lease owned by one newsroom editor session, rather than assuming that a disconnect event must erase the presence. This approach involves using a session-scoped lease with a random presence token that is restricted to one document, one user, one session, and a short expiry.

By doing so, the design becomes more robust and avoids ambiguity when multiple tabs are opened. Additionally, the article recommends replaying awkward sequences to understand how the system behaves under different conditions and to ensure that the lease is properly managed.

Brief written by urgent.news from Dev.to's own syndicated text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

A running plan is a pacing algorithm with a race date bolted on

I've coached myself through three marathon blocks and a handful of halves, and the one thing that always broke down wasn't motivation — it was the spreadsheet.

  • Marathon training plan anchored by race date
  • Digital tool adjusts mileage with 10% cap
  • Compatible with Garmin, Strava for fitness tracking

Thank you!!! 100K Followers

Some times you find your followers- and sometimes they find you. When I signed up for dev.to - I figured it would be another channel to reach a wider audience.

Find the Salesforce fields, flows and validation rules only your senior can explain

Today I wrote on LinkedIn about something you never forget in your career: the person who knew far more than you and, instead of making you feel it, sat down to teach you. Good seniors do that. But in a Salesforce org, a lot of what they teach is never written anywhere. Why does this field exist? Who asked for this flow?

  • Identify Salesforce custom fields, flows, and validation rules lacking descriptions
  • Use Tooling API and SOQL queries to generate list of components
  • Output includes component type, name, last modified admin, activity status, last change date

More from Saturday 14 November →