Build the equivalent of subscribe in GraphQL. So, users can subscribe to a query, and every time something changes, they'll automatically get an updated version of that response. This would be like streaming the results of a query.
A user should be able to specify a query, which would stream results back every time the corresponding data changes. The idea I have is this:
This is a simple design, and it should achieve what we want here.
I think what you're looking for is less subscribe and more live? https://dev-blog.apollodata.com/new-features-in-graphql-batch-defer-stream-live-and-subscribe-7585d0c28b07
Would the following use-case be in-scope:
@jasonkuhrt : Dgraph responses can be nested, and not flat like SQL / NoSQL. So, it's trickier to do a diff and send the diff. Thought, it might be possible.
For now, the task scope is just to return the full results, if there's a change.
For now, the task scope is just to return the full results, if there's a change.
Understood. So for a use-case where the result set is very large, streaming change probably doesn't make much sense.
@manishrjain how far out is this feature from being implemented?
It's an important feature for my use case (real-time collaborative problem solving).
We had a feature freeze to launch v1.0. We'll start working on features in the new year. Expect this in mid-Q1 2018.
Curious to hear if there's been any work on this feature. I currently roll my own eventing for dgraph, and this feature would simplify things.
@insanitybit Any chance that what you have built is public? I'd be curious to see (or hear more about) how you're handling this.
Sure, it's public.
https://github.com/insanitybit/grapl
I pity anyone who reads that code though - I wrote it before I really understood much of dgraph and it's horribly inefficient and verbose. It's the graph-service graph-merger binary.
It's not nearly as efficient as a dgraph-provided system. Basically, when merges occur, I emit events to SNS, and subsequent systems perform queries using the metadata (timestamps).
If I had a native system that would just re-execute the queries and emit the results directly it would cut out quite a lot of complexity.
"@insanitybit insanitybit unassigned janardhan1993 an hour ago"
No idea what that's referring to btw
Any update on this? This would be very useful
Subscriptions is on the 2019 roadmap.
Are there any public design docs for this feature? Any mutation could theoretically match any subscription and it seems like you could hit a performance wall pretty fast with lots of subscriptions. Im guessing there's a way to bound the problem, and Im interested to see what the team is thinking :)
Also on the topic of subscriptions- Will dgraph support piping subscribed queries to a message bus as opposed to requiring a client to have an open connection/subscription? ( which can result in missed data if either go down). Cockroach recently added this and I think it's a killer feature https://www.cockroachlabs.com/docs/stable/change-data-capture.html
This should be part of our next release v1.2, on which we will start working as soon as v1.1 is released by the end of July 2019.
@manishrjain Question, can this be used than from native GraphQL+- interface or only from GraphQL interface? Even if this will support only limited features of GraphQL+-, it would be really great to access from GraphQL+- directly.
Thank you guys for a great database with a great plans 馃憤
This issue is about adding subscriptions to GraphQL+-.
GraphQL has its own subscription system, which we will indeed implement as part as our native GraphQL layer support.
So... Is it implemented yet?
@asminozhka We are working on this and other features. This issue has been accepted and in our backlog. Please watch for new releases and corresponding logs for more information.
@asminozhka don't be begging too much, it's open source and it is to the generosity of the amazing contributors to support this project. if you can you could try and make it happen
We've added subscriptions to Dgraph's GraphQL support. That should be released in 20.07.0.
There's no current roadmap for addressing this for GraphQL+-.
@MichaelJCompton Means, the plan has changed, that most probably for next year there willn't be a support for native GraphQL+-, right?
Use Discuss Issues for reporting issues about this repository.
Most helpful comment
This issue is about adding subscriptions to GraphQL+-.
GraphQL has its own subscription system, which we will indeed implement as part as our native GraphQL layer support.