3 ms·
Not to derail the discussion, but I just got started using GraphQL myself. I've been using Apollo and just started looking at Graphcool. I was wondering if anyo
by faizshah 9y ago
Not to derail the discussion, but I just got started using GraphQL myself. I've been using Apollo and just started looking at Graphcool. I was wondering if anyone knows of an offline first solution for GraphQL on mobile (ios and android, native or nativescript compatible)?
I was hoping to use Apollo on all platforms but it seems I would need to use a custom solution for mobile while on web there's some choices (for offline first): https://github.com/apollographql/apollo-cache-asyncstorage/issues/6 https://github.com/apollographql/apollo-cache-asyncstorage/i...
Currently I'm planning to go with couchdb/couchbase-lite for mobile but I would prefer a graphql solution. I'm also investigating AWS AppSync which appears to have offline support, but I haven't read that deeply into it yet: https://aws.amazon.com/appsync/ https://aws.amazon.com/appsync/
- sorenbs 9y agoIt is my understanding that AppSync doesn't really support offline first yet. I would encourage you to keep an eye on efforts by the community such as Apollo repo you linked or the Khan Academy project mentioned in it. If you need something _now_ you are probably better of looking outisde the GraphQL ecosystem though. You should also consider what your need is. If you need true offline support (ie, you have an app that needs to fully function for days without internet) then that is a very different scenario from just needing to have a bit of data cached for the duration of a subway ride.
- faizshah 9y agoThanks for the info, I just need to allow the client to queue up mutations offline (duration of a subway ride) and then notify the user visually of merge conflicts when we are back online. I don't need true offline support or live collaboration, just a very soft eventual consistency. I just don't want to worry about this while I'm working on core features for launch so I would like a premade solution.
- realPubkey 9y agoHi faizshah. I created RxDB ( https://github.com/pubkey/rxdb https://github.com/pubkey/rxdb ), an offline-first-database (javascript) which works for your requirements, but only with the couchdb-stack. I did many attempts to create a graphQL-plugin which streams graphql-data into an the offline-first store. But this is not completely solvable because of the lacking graphQL-streaming-capabilities. The thing is, when the users goes offline for an hour an then online again, there is no way to get the changes of the last hour out of graphQL which means the user then would either have missing updates or has to redownload the full state again. The current streaming-api of graphQL requires a stable connection and is so not useable for offline-first.
- faizshah 9y agoThanks for the info and the reply, this seems like a great solution for me for nativescript and I like the docs and feature set. But it's a little heavyweight for web, is there a lite version or a way to create a custom build?
- realPubkey 9y agoYes there is an option to do custom builds. https://pubkey.github.io/rxdb/custom-build.html https://pubkey.github.io/rxdb/custom-build.html
- orbitur 9y agoWhen you say "offline first" do you just mean "local db"? You'd rather use GQL over SQL or some other query lang?
- faizshah 9y agoNot just a local db but an eventually consistent cache of remote whose data can be mutated offline and synced back into remote with some kind of conflict resolution. Examples here: http://offlinefirst.org/sync/ http://offlinefirst.org/sync/ In the context of GraphQL I'm talking about a GraphQL client that has offline caching and supports syncing offline mutations. But I could also use something like pouch+couch: https://blog.couchbase.com/introduction-offline-data-storage-sync-pouchdb-couchbase/ https://blog.couchbase.com/introduction-offline-data-storage...