Offix can be used with existing Apollo GraphQL applications as an extension to the Apollo Client. The Offix Client provides additional methods that support various offline use cases.
To work with Offix you should create Offix client.
NOTE: Offix client extends Apollo Client - if you already using Apollo Client you would need to swap it with the Offix client implementation
ApolloOfflineClient is a full
ApolloClient but with some additional features for building offline workflows.
client.init must be resolved before the application makes any queries/mutations, otherwise the cache and storage mechanisms may not work properly.
offix-client-boost is a convenient way to create a client already bundled with all you need to work with GraphQL.
Mainly a cache and Apollo Links subscriptions and file uploads.
Offix Boost is recomended if you trying to build your first GraphQL application and want to have seamless experience.
Client will offer the same API as Apollo GraphQL client. Offix will supply additional methods that help with offline experience.
The following example shows the
client.offlineMutate() method which support sending new mutation while the application is considered offline.
When offline, an error is returned with a reference to a promise which can be used to wait for the mutation to complete. This will happen when the application comes back online.
async/await can be used too.
ApolloOfflineClient is an extension of the Apollo GraphQL client and can be used with various web and mobile frameworks.
For basic concepts about Apollo GraphQL please refer to the documentation for your own platform.
For React: https://www.apollographql.com/docs/react/
For Angular: https://www.apollographql.com/docs/angular/