Skip to content
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

Open
willdeuschle opened this issue Feb 17, 2017 · 8 comments
Open

Subscriptions in flask-graphql #24

willdeuschle opened this issue Feb 17, 2017 · 8 comments

Comments

@willdeuschle
Copy link

Is there any plan to implement this / are you accepting pull requests?

@syrusakbary
Copy link
Member

Hi @willdeuschle, graphql-core and graphene are waiting on the Subscriptions RFC in GraphQL (graphql/graphql-spec#267) to be defined and standardized from the community.

Once that is done, we will start the work :)

@kavink
Copy link

kavink commented Feb 7, 2018

@syrusakbary @willdeuschle Looks like graphql-core/graphene has subscriptions support ? Is there an example to refer of an flask app using subscriptions?

@paunovic
Copy link

Bump. Is there a working example on how to implement subscriptions in Flask-GraphQL? I've tried some things with Gevents but nothing worked.

@rshk
Copy link

rshk commented Sep 11, 2018

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?

@rshk
Copy link

rshk commented Sep 12, 2018

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).

@dtamez
Copy link

dtamez commented Mar 26, 2019

@syrusakbary Since the spec has been updated (graphql/graphql-spec#267) has work begun on adding support for subscriptions in flask-graphql?

@babaMar
Copy link
Contributor

babaMar commented Oct 22, 2019

@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

@adiberk
Copy link

adiberk commented Dec 26, 2024

Any updates on this? How have people gone about adding subscription support with graphene3 and flask?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants