Some applications don't need users to refresh the page every time data changes. Chat applications, dashboards, collaboration tools, and live status pages can benefit from real-time updates. Supabase includes Realtime functionality as part of its platform.
Choose the Table
Start with the table whose changes your application needs to monitor. For example:
messages
Subscribe to Changes
Your frontend can subscribe to relevant database events. Depending on your application, you may care about:
INSERT UPDATE DELETE
Update the UI
When a new event arrives, update your application state. For a chat application, a new message can immediately appear in the conversation.
Don't Send Everything
Only subscribe to data the current page actually needs. Too many unnecessary subscriptions can make an application harder to manage.
Secure the Data
Realtime functionality should still respect your application's security model. Don't expose private information simply because it is being transmitted in real time.
Test Multiple Clients
Open the application in two browser sessions. Make a change in one session and confirm the second session receives the update. That's a simple way to verify that your real-time workflow is working.