Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: clarify private flag behavior for realtime.send (#50537)

Mandar Joshib46b645c6d74
diff --git a/apps/docs/content/guides/realtime/broadcast.mdx b/apps/docs/content/guides/realtime/broadcast.mdx
index 3a3d029f7f0..a3cac8f4605 100644
--- a/apps/docs/content/guides/realtime/broadcast.mdx
+++ b/apps/docs/content/guides/realtime/broadcast.mdx
@@ -17,10 +17,10 @@ The way Broadcast works changes based on the channel you are using:
<Admonition type="note">
-The public flag (the last argument in `realtime.send(payload, event, topic, is_private)`) only affects who can subscribe to the topic not who can read messages from the database.
+The `private` argument of `realtime.send()` controls who can subscribe to the topic. It doesn't control who can read messages from the database.
+- Private (`true`, the default) → Only authenticated clients can subscribe to that topic
- Public (`false`) → Anyone can subscribe to that topic without authentication
-- Private (`true`) → Only authenticated clients can subscribe to that topic
Regardless if it's public or private, the Realtime service connects to your database as the authenticated Supabase Admin role.
@@ -507,10 +507,10 @@ You can send messages directly from your database using the `realtime.send()` fu
```sql
select
realtime.send(
- jsonb_build_object('hello', 'world'), -- JSONB Payload
- 'event', -- Event name
- 'topic', -- Topic
- false -- Private flag - true: Private (default), false: Public
+ payload => jsonb_build_object('hello', 'world'),
+ event => 'event',
+ topic => 'topic',
+ private => true -- true = private channel (default), false = public channel
);
```
@@ -528,10 +528,10 @@ To broadcast a binary payload from your database, use the `realtime.send_binary(
```sql
select
realtime.send_binary(
- '\x012345'::bytea, -- bytea payload
- 'event', -- Event name
- 'topic', -- Topic
- true -- Private flag - true: Private (default), false: Public
+ payload => '\x012345'::bytea,
+ event => 'event',
+ topic => 'topic',
+ private => true -- true = private channel (default), false = public channel
);
```
@@ -1035,12 +1035,13 @@ Broadcast Changes provides two functions to help you send messages:
The `realtime.send()` function provides the most flexibility by allowing you to broadcast messages from your database without a specific format. This allows you to use database broadcast for messages that aren't necessarily tied to the shape of a Postgres row change.
```sql
-SELECT realtime.send (
- '{}'::jsonb, -- JSONB Payload
- 'event', -- Event name
- 'topic', -- Topic
- FALSE -- Public / Private flag
-);
+select
+ realtime.send(
+ payload => '{}'::jsonb,
+ event => 'event',
+ topic => 'topic',
+ private => true -- true = private channel (default), false = public channel
+ );
```
### Broadcast record changes