Subscriptions are not allowed.
I followed the example and I got
Subscriptions are not allowed. You will need to either use the subscribe function or pass allow_subscriptions=True
What am I missing?
Hi @masarliev, you must make sure that the graphql url of your project defines it using the view graphene_django_extras.views.ExtraGraphQLView, something like that
from graphene_django_extras.views import ExtraGraphQLView
urlpatterns = [
# .....
url(r'^graphql', ExtraGraphQLView.as_view(graphiql=True, schema=schema), name='graphql'),
]
Please can you please let me know if the error was corrected. Right now I am working on an update of this module and its documentation
Thanks for the fast replay. I am still getting the same error. Later today or tomorrow I can provide simple application
https://github.com/graphql-python/graphql-ws/issues/8 I have the same problem as here
https://github.com/masarliev/subs-example @eamigo86 here is the example project
Hi @masarliev , I was reviewing your project and apparently it lacks the definition of the file asgi.py, and it's mandatory for Channles. Could you send me what the command "pip freeze" returns?
for this I was using docker python:3.6 image and install all required packages from requirements.txt
I found that using python setup.py install from master branch works like charm
defining a custom GraphQLCoreBackend can pass allow_subscriptions to execution context like:
class GraphQLCustomCoreBackend(GraphQLCoreBackend):
def __init__(self, executor=None):
# type: (Optional[Any]) -> None
super().__init__(executor)
self.execute_params['allow_subscriptions'] = True
then it can be passed to your GraphQL view (say):
url(r'^graphql', GraphQLView.as_view(graphiql=True, backend=GraphQLCustomCoreBackend()))
https://github.com/graphql-python/graphql-ws/issues/8#issuecomment-482062178