Broadcast a message to all connected clients to a channel.
supabase.realtime
.channel("room1")
.subscribe { status, error in
if status == .subscribed {
Task {
await channel.send(
type: "broadcast",
event: "cursor-pos",
payload: ["x": Double.random(in: 0...1), "y": Double.random(in: 0...1)]
)
}
}
}
await supabase.realtime
.channel("room1")
.send(
type: "broadcast",
event: "cursor-pos",
payload: ["x": Double.random(in: 0...1), "y": Double.random(in: 0...1)]
)