Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How are the real time subscriptions with SQLite achieved? Is this a feature of SQLite itself or something that PocketBase itself implements on top of it?


It's implemented in the application, it's not a feature of SQLite, but its very simple and robust - when a record is created/updated/deleted I'm broadcasting the change to all subscribers that are allowed to receive it (the access control is based on the colleciton's list and view rules).

The realtime api implementation could be found at https://github.com/pocketbase/pocketbase/blob/master/apis/re...


Reading through the code/docs it looks like you can subscribe to individual records (database rows) or collections (tables), is this correct? In your Records.getList method, you have filter functionality that would be nice to subscribe to (ie. subscribe to changes in "demo" collection where totalComments > 10). Subscribing to a specific result set seems like it could scale better than notifying subscribers of all table changes, which then get filtered in the subscribe() callback func in the SDK. Very cool work!


Yes, you can subscribe to individual records or collections.

User defined filters for the subscriptions are not supported, but it's a good idea and I may consider it in the future.

Currently the subscriptions are filtered through the collection's list and view rules - they also act as "admin level filters", aka. filters that are always applied and regular users cannot modify (getList user defined filters are only appended to the search query together with the admin defined filters).


That makes a lot of sense. Thanks for the link. I've not worked with Go before so I couldn't find exactly where the implementation was.

This looks like a very interesting project and great for some of the small client projects which I currently use Firebase. I'll be sure to take a proper look in the future!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: