-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class-based subscription fields #1930
Conversation
Nice! I like it. How do you hook up the transport? I'm assuming there needs to be some method that GraphQL can invoke when an update needs to be sent to a client?
It is going to send the update to every client by default, and your |
Thanks for taking a look!
That consideration is separated a bit. The changes here revolve around how subscriptions are evaluated by GraphQL, but not how the result is transmitted to clients. In terms of transport, the subscription implementation should define
Yes, that's right. I'm glad you mentioned it: it should really have a way to halt, and send nothing to a client if desired, but there's not a way to do that yet. I added a TODO above. |
we've hit this a few different times - mostly because of my understanding on how scoping works it's hard to have multidimensional filters (ie, company A + role B). we sometimes end up sending out notifications on a model which is not visible for some clients. if we allow the subscription field to be null, then we send out empty messages to a bunch of clients. my hacky solution was to make the field non-nullable and hide the |
fb056c2
to
142d783
Compare
It's basically implemented as written, feel free to take another look if you're interested! Otherwise I'll merge it tomorrow or so. |
I'm so excited about this @rmosolgo, thank you for all your amazing work. ✨ |
The current subscription system leaves a lot to be desired, see for example #1528 #1799 #1910
I'm proposing a
GraphQL::Schema::Subscription
likeGraphQL::Schema::Mutation
with authorization, initialization, and update methods.You can see the rendered doc here: https://github.com/rmosolgo/graphql-ruby/blob/good-subscriptions/guides/subscriptions/subscription_classes.md
TODO: