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

1

8

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.

Otti answered 16/10, 2015 at 11:8 Comment(1)
Just curious -- I am toying with the idea of building an app in Ionic 2 (Typescript) but I will need to access a back end with GraphQL. Any particular reason why you were planning to move to React/Redux, and any lessons learned from whatever you did actually end up doing? Any thoughts on starting a project in Ionic2 + GraphQL?Inflationary
G
3

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.

Gooding answered 28/10, 2015 at 10:45 Comment(2)
Thnx @Lukas. I am looking at a situation though where the user will go on for a few days at a stretch in offline mode and use content he/she has downloaded. Finally, when user comes offline, the updates are to be synced to the server. I dont see if such a use case is something they have in mind or it is just considering temporary offline use. Hope to see the updates.Otti
@LukasLiesis did your bet hold true?Croft

© 2022 - 2024 — McMap. All rights reserved.