3 ms·
https://docs.nhost.io/graphql/subscription https://docs.nhost.io/graphql/subscription Nhost seems to be based on the Hasura GraphQL server so you would impleme
by snorremd 6y ago
https://docs.nhost.io/graphql/subscription https://docs.nhost.io/graphql/subscription
Nhost seems to be based on the Hasura GraphQL server so you would implement live synchronization of data using GraphQL subscriptions. Hasura runs each subscription in a per second poll to get live data for each subscription. If the data changes it passes down the result to the graphql client.
https://github.com/hasura/graphql-engine/blob/master/architecture/live-queries.md#scaling-to-1-million-active-graphql-subscriptions-live-queries https://github.com/hasura/graphql-engine/blob/master/archite...
- zwily 6y agoIt polls the database every second for every subscription? How does that scale to a lot of subscriptions?
- elitan 6y agoYou can read about it in detail here: https://hasura.io/blog/1-million-active-graphql-subscriptions/ https://hasura.io/blog/1-million-active-graphql-subscription...
- Scarbutt 6y agoThis is not the same at all as live synchronization between devices, also, the Firebase SDK clients allow for offline data persistence.
- snorremd 6y agoSorry I fail to see the big distinction between Firebase realtime synchronization and graphql subscriptions. There might be one, and I just don't see it as I'm not intimately familiar with Firebase. Firebase data retrieval definitions and graphql subscriptions look very similar too me. Both methods allow you to describe some data record(s) or document(s) to be fetched, fetches it, and then listens for server notifications about data changes for it including the changeset or new data. https://firebase.google.com/docs/database/admin/retrieve-data https://firebase.google.com/docs/database/admin/retrieve-dat... That clients receive events in milliseconds with Firebase and potentially with a second delay with Hasura is a performance detail. The functionality still serves the same general purpose? When one client modifies some document or record immediately notify all subscribing clients.