diff --git a/apps/docs/content/guides/realtime/broadcast.mdx b/apps/docs/content/guides/realtime/broadcast.mdx index 657e287d75c..579a9e726ed 100644 --- a/apps/docs/content/guides/realtime/broadcast.mdx +++ b/apps/docs/content/guides/realtime/broadcast.mdx @@ -693,12 +693,13 @@ The database broadcast feature 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 ( - to_jsonb ('{}'::text), -- JSONB Payload - 'event', -- Event name - 'topic', -- Topic - FALSE -- Public / Private flag -); +select + realtime.send( + jsonb_build_object('hello', 'world'), -- JSONB Payload + 'event', -- Event name + 'topic', -- Topic + false -- Public / Private flag + ); ``` ### Broadcast record changes @@ -772,7 +773,9 @@ Finally, client side will requires to be set up to listen to the topic `topic: console.log(payload)) .on('broadcast', { event: 'UPDATE' }, (payload) => console.log(payload)) .on('broadcast', { event: 'DELETE' }, (payload) => console.log(payload))