Skip to content

Commit f905942

Browse files
authored
docs: add explanation of Realtime Broadcast usage in Realtime Chat (supabase#40882)
Adds a section explaining that Realtime Chat uses Realtime Broadcast, does not store messages by default, and relies on onMessage for persistence. Improves developer understanding of expected behavior.
1 parent f5791c3 commit f905942

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

apps/ui-library/content/docs/nextjs/realtime-chat.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ description: Real-time chat component for collaborative applications
2020

2121
The Realtime Chat component provides a complete chat interface that enables users to exchange messages in real-time within a shared room.
2222

23+
## How it works under the hood
24+
25+
This chat component uses **Supabase Realtime Broadcast** to send and receive messages between connected clients.
26+
27+
Messages sent through Broadcast are:
28+
29+
- delivered in real time to other connected clients
30+
- **not stored** unless you handle persistence yourself
31+
- **not guaranteed** to arrive if the client disconnects
32+
- scoped to a specific `roomName`, which corresponds to a broadcast channel
33+
34+
This design keeps latency extremely low, but it means you should use the `onMessage` callback if you want to store messages permanently or show chat history on page load.
35+
2336
## Usage
2437

2538
### Basic usage

0 commit comments

Comments
 (0)