Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use GraphQL with an offline mobile database like SQLite or PouchDB

I am looking at Relay / GraphQL. Looks great to use with React but my main concern is whether it is possible to use GraphQL in an offline mode. In my Hybrid app built currently using Ionic Framework (AngularJs based), am planning to shift out to React, Redux. In terms of fetching data from server, Relay / GraphQL look great but how would I run a GraphQL instance locally on mobile when the user is offline? Is this a valid use case for Relay / GraphQL. As of today, i use PouchDB as my local database.

like image 786
Amrudesh Avatar asked Oct 16 '15 11:10

Amrudesh


1 Answers

There was only one update about offline in Blogpost 2015-08-11

https://facebook.github.io/react/blog/2015/08/11/relay-technical-preview.html

What's Next:

Offline support. This will allow applications to fulfill queries and enqueue updates without connectivity

I would use WebSocket to check if online and show some kind of notification when offline. Just don't execute queries while offline.. Or if you want better UX, try to make abstraction layer to save most recent data + mutations and push update to server when connection is established.

React Conf will be 2016-June https://www.react-europe.org/ I think they will make it before that date and announce during conf or before, but it's just my personal opinion.

like image 189
Lukas Liesis Avatar answered Nov 14 '22 17:11

Lukas Liesis