graphql-python / graphene-django

Build powerful, efficient, and flexible GraphQL APIs with seamless Django integration.
http://docs.graphene-python.org/projects/django/en/latest/
MIT License
4.29k stars 768 forks source link

Anyone knows how to properly create subscriptions (real time api )in django graphene? #1201

Open aliscie opened 3 years ago

aliscie commented 3 years ago

I am using Django graphene and I successfully created queries and mutations, but when it comes to the subscription I find out the graphene doesn't sopported officially but it suggesting few libraries with very vague documentations and not working examples at all. However, I created a web socket chat app before but when it came to subscription it never works with me. any ideas any working exampes please?

davidrideout commented 3 years ago

I'm also having some challenges and wondering if anyone has a better solution.

I successfully implemented a graphql subscription by following the chat example for channels_graphql_ws. I tried other libraries with poor results.

The frontend however, was a nightmare:

I'm still working on it, and expect more issues to come up.

Anyone else able to implement a full e2e react+django+graphene solution?

ryarasi commented 3 years ago

Any updates to this? I'm also stuck on the same boat. It works sporadically. I use an Angular UI that uses Apollo client to interface with Django 3.2 using Graphene and channels with Redis server. It takes a few hits to the API to start the subscriptions. So sometimes it works usually after a little bit of running the App but initially right after loading, the subscriptions fail to connect. It's all so messy with so many third party plugins involved that troubleshooting has been a nightmare.

Instrumedley commented 2 years ago

I'd love some updates on this too

eslamelhadedy commented 5 months ago

I create libirary to solve this https://pypi.org/project/cypartagraphqlsubscriptionstools/