SupabaseS
Supabase4y ago
Tom

How to do Realtime Application State Tracking

Hi guys. I currently have an app that I built with Cloud Firestore and I'm seeing if its possible to convert it to Supabase, mostly so I can utilize the relational DB. However, the heart of my application requires that users are able to subscribe directly to the state of the database, which is kind of the main selling point of Firestore.

To be clear, I want the equivalent of a cloud firestore subscription:
- My server backend to update a database full of JSON objects
- When a change is made to a JSON object, all clients who are subscribed to that object are notified
- If possible I would like type safety (I have Prisma for all of my non-realtime database interactions)

I'm not 100% sure how I would do this in Supabase. Presence looked like the right tool at first, but after playing with it a bit it looks like all the users get their own state within the channel. I also don't really want clients to be able to call track() and add to the state for security reasons.

Does anyone have any suggestions? Thanks.
Was this page helpful?