Replies: 2 comments 6 replies
-
Hi @redlock we already use the WAL for realtime :). I might be misunderstanding your suggestion though - feel free to add some more details if you think we can improve - we're always looking for better performance. |
Beta Was this translation helpful? Give feedback.
-
I was thinking about this more, @thorwebdev interested to get your view on the DX of this. For some cases like Here is how it might look /**
* Example of how to do ephemeral data
*/
// A client could be any browser tab or mobile etc.
// It's up to the user to specify some identifying data (supabase-js will create a UUID for every client)
type Client = {
name: string,
email?: string
}
// Here I set up some identifying data for this browser tab
let currentClient: Client = {
name: "Paul",
}
// Here we connect to a room "my-room-name" with my info.
// A room name can be any string - probably a URL in most cases
const { room, error } = await supabase
.presence("any-room-name", {
password: "p@ssword",
client: currentClient
})
// Here we broadcast my mouse position to everyone in the room
// The developer could call this as much as want,
// although we would probably throttle it behind the scenes to send to the server every 50ms by default
room.broadcast({
mouse: {
x: 323,
y: 631
}
})
// Here we receive data from the users
room.receive((data: Set) => {
// data is a Set, like this:
/**
{
'04095645-6aa5-4e65-a7e3-2ddbfce480c6': {
client: {
name: 'Paul'
},
data: {
mouse: {
x: 323,
y: 631
}
}
},
'0369b45d-8b15-4d42-b618-ae439dd8c2da': {
client: {
name: 'Thor'
},
data: {
mouse: {
x: 323,
y: 631
}
}
}
}
*/
}); A couple of notes:
|
Beta Was this translation helpful? Give feedback.
-
Hello,
Was just wondering whether using WAL can make realtime faster since you don't need to wait for disk writes.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions