What Does 'Enable Realtime' Mean in Supabase Tables?

When you create or edit a table in Supabase, you’ll see an option:

Enable Realtime
"Broadcast changes on this table to authorized subscribers"

 

What Does It Mean?

It means Supabase will broadcast changes in the table such as INSERT, UPDATE, or DELETE to all authorized subscribers in real time.

 

Example Usage

Imagine you have a table called sales_log that tracks your sales team’s location data. If Enable Realtime is checked, your Flutter app (or any frontend) can instantly receive updates whenever a new entry is added or modified in that table no need to refresh or re-fetch data manually.

 

What Are "Authorized Subscribers"?

This means only users who are authenticated and have the proper Row Level Security (RLS) permissions will receive these realtime updates. Supabase won't push data to just anyone it respects your security rules.

 

When Should You Enable Realtime?

  • Enable it if your app needs live updates, such as:
    • Live chat
    • Location tracking
    • Real-time notifications
    • Interactive dashboards
  • Don’t enable it if:
    • The table is static or rarely changes
    • You don’t need instant updates in your frontend

 

Flutter Example Using Realtime


Supabase.instance.client
  .channel('public:sales_log')
  .onPostgresChanges(
    event: PostgresChangeEvent.insert,
    schema: 'public',
    table: 'sales_log',
    callback: (payload) {
      print('New data received: ${payload.newRecord}');
    },
  )
  .subscribe();

With this setup, your Flutter app will respond in real-time to any new data added to the sales_log table!

0 Comments:

Post a Comment