Hacker News new | ask | show | jobs
by avinassh 1379 days ago
How are they handling real time subscriptions? Like, how do they figure out when a row is updated? Postgres has replication functionality, but how are they achieving same with SQLite?
2 comments

The document for pocketbase's realtime is: https://pocketbase.io/docs/api-realtime/

The Realtime API is implemented via Server-Sent Events (SSE). Generally, it consists of 2 operations:

  * establish SSE connection

  * set client subscriptions
SSE events are sent for create, update and delete record operations.

Pocketbase is mainly a single application with SQLite embedded, so, whenever you update records through PocketBase's API, the main application always knows that.

This is different with postgres, since it may be connected by several different applications/servers remotely.

> Like, how do they figure out when a row is updated?

AFAICT because you can only update a row via the UI, it's easy to tell when a row is updated.

But if you're talking about raw SQLite, there's [1].

[1] https://www.sqlite.org/c3ref/update_hook.html