mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 10:55:06 +03:00
update example
This commit is contained in:
1 parent
e8e493f441
commit
4bb7c445aa
1 file changed
+3
-4
@@ -34,10 +34,9 @@ channel.subscribe(async (status) => {
|
||||
setInterval(async () => {
|
||||
const status = await channel.send({
|
||||
type: 'broadcast',
|
||||
event: 'post',
|
||||
payload: { x: 0, y: 0 },
|
||||
event: 'location',
|
||||
payload: { x: Math.random(), y: Math.random() },
|
||||
})
|
||||
|
||||
console.log(status)
|
||||
}, 1000)
|
||||
}
|
||||
@@ -59,7 +58,7 @@ const channel = supabase.channel('user1-location')
|
||||
|
||||
// listen to broadcasts
|
||||
channel
|
||||
.on('broadcast', { event: 'post' }, (payload) => console.log(payload))
|
||||
.on('broadcast', { event: 'location' }, (payload) => console.log(payload))
|
||||
.subscribe(async (status) => {
|
||||
if (status === 'SUBSCRIBED') {
|
||||
console.log(status)
|
||||
|
||||
Reference in new issue
Block a user