2

I'm developing a set of services / applications to allow to manage Archery Tournaments. It consist on a web application that would manage the creation of different tournaments, and will handle the subscription of archers as contenders, mailing and classifications. And a mobile application that will be installed into several tablets that are going to be used for annotate each archer arrow point in realtime during the tournament.

This last part will be deploy and used in a local network that won't have external internet access (although it will be able to connect to retrieve the tournament data). So I decided to use kuzzle (https://kuzzle.io/) as backend as I could deploy it on site, developing the web app in angular and the realtime capabilities.

The only think that is not covered is to have offline capabilities, so if the annotation tablets lost connection to the kuzzle server the archers must still be able to take note of the points. So one of the solutions is to define a GraphQl endpoint into kuzzle (https://github.com/kuzzleio/kuzzle-plugin-graphql) and using a Graphql client that would allow some kind of offline cache like https://www.apollographql.com/ but I will still miss the realtime syncronization that kuzzle provides.

Is there any way / idea on how to map from the apollo graphql queries to kuzzle runtime so the later could update the apollo cache? Is any other configuration better?

gpulido
  • 113
  • 3
  • 9

1 Answers1

1

Kuzzle core team member here.

TL;DR - GQL Live Subscriptions aren't supported yet by Kuzzle. You can use the Kuzzle Realtime engine to subscribe to data and retrigger GQL queries.

The current offline capabilities the Kuzzle SDK offers enable you to recover a live subscription upon reconnection and to replay enqueued actions that couldn't be sent to the server while offline, but has actually no opinion (nor tool) on how you should handle unsynced data.

In this situation, it is complex to have two datastores (the backend and the frontend) that might not be in sync (due to limited connectivity), specially if you need to query the data.

Many frontend DB solutions exist, but they imply you should double the queries on each data-fetch (with different DSLs) then reconciliate the results, as they might differ. It's not impossible, but it's an effort.

This is a good motivation to use GraphQL in conjunction with Kuzzle, which is a good take, but the GraphQL Live Queries aren't supported yet, so you won't be able to use GQL queries to express your realtime subscription filters. The core team is actively considering supporting them during this year.

A workaround is to give up the GQL Live-Queries for the moment and make your subscriptions using Kuzzle (via the realtime.subscribe call). Each time the subscription receives a notification, it would re-trigger the GQL query to fetch the fresh dataset. The only overhead would be that your subscription filter must be expressed in the Koncorde DSL, which might be annoying at scale, but IMHO, still viable.

xBill
  • 233
  • 1
  • 7