-
Notifications
You must be signed in to change notification settings - Fork 89
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
Pubsub implementation for easily publishing and subscribing from your resolvers #11
base: master
Are you sure you want to change the base?
Conversation
@hballard Wondering if python2.7 compatibility is needed? |
@kavink It should work fine now under python 2.7. |
@syrusakbary Any comments and feedback on if you would accept this in mainline ? cc: @hballard Would be great if we get it in after whatever changes are needed. |
@hballard when I run Flask example and from graphql when I try to subscribe. I get following error
|
@hballard instead of running under gunicorn, running from command line, it runs, But I dont see the results. The subscription needs: But the type it gets is So I am unable to subscribe , also Error is not showing up to end user, in Graphiql I see |
I think I found the issue, I had to remove all other files except keep |
@kavink I need to see an example of your code to see where you are having an issue. The gevent example I modified runs fine on my machine, from the command line. |
@hballard Thanks, I got it working now from graphiql, Now im trying to make it run under |
@hballard Awesome !!! thanks a lot for your work .. I Got it working https://bitbucket.org/noppo/gevent-websocket just had to provide worker-class. I am all set now . Thanks!
|
Only annoyance right now is being required to have |
@hballard @syrusakbary Now that I got Subscriptions working for simple example, wondering how can I do the following in RxPy, which will keep querying database using SQLAlchemy till a condition is met, I see there or maybe is it possible to plumb How can I create an Observable which will keep querying DB till condition is met and not query after condition is met, and just display last response ? or maybe this a worth another issue for discussion in community on how to do it ? |
@kavink You can query the database for a condition, but you don't really need to. That is what you can use these classes for. Your mutations will usually be tied to updating a database. Just publish each mutation to a channel (inside your mutation resolver), after you write a mutation to your database and before it returns, and then any subscriptions subscribed to that channel (in their resolver) will automatically be updated. See this article for some good background on this concept. Probably move this to another issue (and not this pull request) if you need further discussion. |
@hballard The |
@hballard figured it out.. I should be using |
@hballard @syrusakbary Any chance we can know whether this is getting merged or not? I'm trying to setup subscriptions and this seems like it changes things around a fair amount |
@hballard nice work on this; thank you! Was able to get the aio version working without much issue at all and am also hoping this can be merged soon. The only thing I encountered was packaging-related; I think you'll want to replace the |
Thanks @bendemaree! @benwis I don't know that this "changes things around" much with the base library...you can still use the base library as is, without the classes contained in this PR. However, the PR adds simple classes that utilize a pubsub / observer pattern that you would probably need to implement yourself to get true working "subscriptions". This is a similar mechanism to what the ApolloGraphql JS subscriptions library does. @syrusakbary let me know if you'd like me to make any modifications to this PR to get it approved. |
@hballard Any chance you can tell me whether this or your graphql-python-subscriptions is the better package to use? Your documentation looks quite a bit nicer but it doesn't look like it's been updated in a while. Thanks! |
I'd use this repo, as opposed to the other one I wrote. I've pretty much deprecated it in favor of this repo once @syrusakbary released it, since it somewhat more official and a part of the graphql-python repo. |
@kavink How did you solve the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check my comments
@syrusakbary let me know your thoughts on this pull request when you get a chance. I modified the README and all the examples (except the Django one), to show how this would work.