docs(realtime): alert about high-frequency updates using presence (#45502)

## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Clarify that presence should not be used for high-frequency updates

<img width="1070" height="793" alt="Presence___Supabase_Docs"
src="https://github.com/user-attachments/assets/76e736da-12c3-46ba-8301-6f777e83c900"
/>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Added guidance on optimal use cases for Presence feature, clarifying
it's best suited for slow-changing state and recommending Broadcast for
high-frequency updates.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
This commit is contained in:
Eduardo Gurgel
2026-05-22 02:32:23 +12:00
committed by GitHub
parent 31c8601201
commit db195ca91c

View File

@@ -20,6 +20,14 @@ When any client subscribes, disconnects, or updates their presence payload, Supa
- **`join`** — a new client has started tracking presence
- **`leave`** — a client has stopped tracking presence
<Admonition type="caution" title="Presence is not designed for high-frequency updates">
Presence syncs state through the server and notifies **all** subscribers on every change. Calling `track()` rapidly — for example on every mouse move to share cursor positions — will flood the channel and cause performance problems.
For high-frequency or fire-and-forget updates, use [Broadcast](/docs/guides/realtime/broadcast) instead. Presence is best suited for slow-changing state such as online/offline status, active document, or current page.
</Admonition>
<Admonition type="note" title="Sync event behavior">
During a `sync` event, you may receive `join` and `leave` events simultaneously, even though no users are actually joining or leaving. This is expected behavior—Presence reconciles its local state with the server state, which can trigger these events as part of the synchronization process. This reflects state reconciliation, not real user movement.