-
Notifications
You must be signed in to change notification settings - Fork 139
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
Subscriptions in flask-graphql #24
Comments
Hi @willdeuschle, Once that is done, we will start the work :) |
@syrusakbary @willdeuschle Looks like graphql-core/graphene has subscriptions support ? Is there an example to refer of an flask app using subscriptions? |
Bump. Is there a working example on how to implement subscriptions in |
I'm using subscriptions via graphql-ws. See example: https://github.com/rshk/yawc/ Messages are forwarded to subscriptions via a Redis PUB/SUB (this allows scaling to >1 app/websocket server). HOWEVER, I'm still having some trouble figuring out how to properly deal with those RxPy Observable objects. As it is right now it works BUT it will create a new Redis connection / subscription for every new GraphQL subscription, and it will never close them, even when the websocket is closed on the client side. I'm assuming there's some way the Observer can signal to the Observable when to stop, but I haven't find how it's supposed to work yet. This assuming things are done properly in graphql-ws, i.e. it's not missing some call that's supposed to signal to the observer when to stop. What I would like to do btw is to actually have one redis subscription per process, and just dispatch the messages internally to all the subscriptions that are currently listening. This to reduce the amount of unnecessary traffic (and as a bonus make it work on the free heroku-redis plan). Any suggestions are welcome, maybe the graphql-ws authors have some hints about how to make this work? |
Looks like this does the trick: rshk/yawc@95d6e50 (It will basically make all subscriptions listen from the same Observable, so it definitely stops countless Redis connections from being created / never disposed of). |
@syrusakbary Since the spec has been updated (graphql/graphql-spec#267) has work begun on adding support for subscriptions in flask-graphql? |
doesn't seem so |
Any updates on this? How have people gone about adding subscription support with graphene3 and flask? |
Is there any plan to implement this / are you accepting pull requests?
The text was updated successfully, but these errors were encountered: