If your app uses Supabase Realtime to subscribe to database changes (via e.g. Stream in the Supabase Flutter client library), it’s fairly simple to obtain the same behavior using PowerSync.

Postgres changes are constantly streamed to the PowerSync Service via the logical replication publication.

When the PowerSync client SDK is online, the behavior is as follows:

  1. Data changes are streamed from the PowerSync Service to the SDK client over HTTPS
  2. Using the watch() API, on-device SQLite database changes can be streamed to your app UI

When the SDK is offline, the streaming stops, but automatically resumes when connectivity is restored.

Example implementations of watch() can be found below