Answer
Heartbeats with a timeout: the client pings every N seconds, and the server keeps a last-seen time (e.g. a key with a TTL). If no heartbeat arrives within about 2–3 intervals, the user is shown as offline.
Realtime · Flashcard
Heartbeats with a timeout: the client pings every N seconds, and the server keeps a last-seen time (e.g. a key with a TTL). If no heartbeat arrives within about 2–3 intervals, the user is shown as offline.