You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
Live Queries observe data, subscriptions observe events
I stumbled upon cases where I specifically want to react to events. Example: to trigger some animations in the front-end when something happens.
Note that GQL eco-system (example: apollo-client, graphql-code-generator..) uses this distinction between the 2 concepts, and making the distinction helps to leverage the eco-system.
Use live queries as event subscription can lead to pitfalls
If one really wants to implement an event subscription with reactive-graphql, as a workaround one can use a regular reactive query:
I think you are right and I would assume it's a doable change. We need to implement the Subscription interface, there should be tests in graphql-js that we can borrow to make sure we are spec compliant
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
As noted in Readme, today's implementation does not support subscriptions and it is, a priori, not a big deal because as noted in Readme:
Though, I figured out some benefits of having support for proper GraphQL Subscriptions:
Support conceptual difference between live queries and subscription
There is a conceptual difference between live queries and subscription that is well summarized with:
I stumbled upon cases where I specifically want to react to events. Example: to trigger some animations in the front-end when something happens.
Note that GQL eco-system (example: apollo-client, graphql-code-generator..) uses this distinction between the 2 concepts, and making the distinction helps to leverage the eco-system.
Use live queries as event subscription can lead to pitfalls
If one really wants to implement an event subscription with
reactive-graphql
, as a workaround one can use a regular reactive query:But this can lead to emitting much more events than expected if the
Post
is changing live:The text was updated successfully, but these errors were encountered: