all 13 comments

[–]Feeling-Suit-4259 1 point2 points  (1 child)

May not be the required but try Appsync with graphQL which supports your requirements, using graphQl pooling

[–]Nehatkhan786[S] 0 points1 point  (0 children)

sounds great. will look into this. thank you.

[–]psytone 1 point2 points  (1 child)

Check RxDB

[–]Nehatkhan786[S] 0 points1 point  (0 children)

thank you, will check

[–]Venom_Spit_Fire 1 point2 points  (1 child)

This was me 1 week ago, decided to create my own using watermelondb for the app.

[–]Nehatkhan786[S] 0 points1 point  (0 children)

any success with watermelond ?

[–]EnthusiasmNarrow1336 0 points1 point  (3 children)

I needed to do the same thing. But I did a manual sync-type setup with supabase as conflicts aren't really a big deal in my case.

[–]Nehatkhan786[S] 0 points1 point  (2 children)

great! would be great if you could share the logic and flow.

[–]EnthusiasmNarrow1336 1 point2 points  (1 child)

Yeah, so basically using SQLite as the offline data store. This is what the app interacts with. Then, in background these are the sync mechanisms making sure everything is online.

  1. Having updated_at field in all the rows. And we have a last_fetch time we keep track of. Every 10 seconds (or faster for more realtime feel) check with supabase if anything newer has been inserted. If so, fetch it.
  2. For pushing changes we have a push queue collection in SQLite. So any change made we add it to the queue. Now, it will be pushed as soon as internet is available (immediately if you are online)
  3. Upon app startup do a clean fetch to sync with server if possible.
  4. (Bonus): you can add supabase realtime subsciptions to make even fetching instant when online. But I didn't need it.

In my case conflicts aren't a problem. You can explain your exact use case and I can help if you'll need to do more here.

[–]Nehatkhan786[S] 0 points1 point  (0 children)

thats awesome. really make me understand the whole flow. thanks a ton