update example

This commit is contained in:
Inian committed 2022-08-18 17:10:30 +08:00
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)