Graphene: How to create a subscription with graphene relay so i can be used in front end

Created on 19 May 2018  路  8Comments  路  Source: graphql-python/graphene

Hello I need someone to explain to me on how to create a subscription type with graphene relay. Thank you :)

Most helpful comment

Thanks a lot, @dvndrs, too because I didn't know the button "Used By", it would very useful. A bit later I found another module, django-channels-graphql-ws, for creating subscriptions that includes an example for graphene and works successfully.

https://github.com/datadvance/DjangoChannelsGraphqlWs

All 8 comments

Hi @bellomusodiq , you can find instructions on how to set up subscriptions in the graphql-ws repo

@jkimbo I have been trying but still not getting it. How do I check if it is working. I use Django by the way

You can try it out in the GraphiQL browser or use a compatible client library like Relay or Apollo. There is an example of how to setup subscriptions in Django with Django Channels: https://github.com/graphql-python/graphql-ws#django-channels

Thank you. I'll try it

Hello, I am trying to create subscriptions for creating, updating and deleting from Django models but I don't find any example or tutorial. The example don't seem work for me and don't use models in subscriptions too. Can anyone explain to me how to create subscriptions for models or where find an example?

(Sorry my English)

@Nieto2018 I believe you'll need to refer to the documentation here for Django channels: https://github.com/graphql-python/graphql-ws#django-channels

You might be able to look at the Github "Used By" button on top to try to find a project that's a more relevant example for you. (sorry I can't be more specific)

Thanks a lot, @dvndrs, too because I didn't know the button "Used By", it would very useful. A bit later I found another module, django-channels-graphql-ws, for creating subscriptions that includes an example for graphene and works successfully.

https://github.com/datadvance/DjangoChannelsGraphqlWs

@Nieto2018 You are right and https://github.com/graphql-python/graphql-ws not using the latest version of django-channels

Was this page helpful?
0 / 5 - 0 ratings