# Supabase Realtime

### Online Presence

Presence can be used to share state between clients. Each client maintains their own piece of state within the shared state.

Presence utilizes an in-memory conflict-free replicated data type (CRDT) to track and synchronize shared state in an eventually consistent manner.

<figure><img src="/files/ZKGL1XA1XaI475aJPR05" alt=""><figcaption></figcaption></figure>

* **Channel Name:** This is the Channel the Users would communicate. The name should be the same for the Users you'd like to show each others state. \
  \
  So let's say you have a Project Management App, and you have Workspaces for different companies, in this case the Channel name should include a Unique ID of that Company, so that the Users belonging to that Company can receive the data.&#x20;
* **Key to track**: This most probably be the Current User's UID.

The element has now a state **"Presences".** This will be the list of text of everybody's UID who's currently subscribed to the Channel. &#x20;

* You can send/receive 5 messages per client per second (Meaning 1 message every 200 milliseconds).
* This will add to your Realtime quota in your Project.&#x20;

### Live Cursor

This is a fully custom action using Supabase Realtime. It tries to mimic a Figma or Miro style live cursor visual element.&#x20;

<figure><img src="/files/7hhD6NCSXjXoo1DjJs7w" alt=""><figcaption></figcaption></figure>

* **Channel Name:** This is the Channel the Users would communicate. The name should be the same for the Users you'd like to show each others state.&#x20;
* **Key to track**: This most probably be the Current User's UID or other unique Identifier.&#x20;
* **Caption**: This most probably be the Current User's Email or Name. This is what shows up as a caption for the cursor.
* **Color:** This is the color of the cursor on the screen. The plugin will automatically adjust the text color for the caption for light and dark colors. Meaning if the color you add here is a really dark color the plugin will show the text white, and if the color is really light, the plugin shows the text black.

Live cursor will hide a  User's cursor after 2 minutes of being Idle. If the user move their cursor again the whole process will start again.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.relevat.hu/supabase.js-bubble-plugin/setup/supabase-realtime.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
