We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
after handshake, we got this error. Exception inside application: No route found for path 'graphql'.
we implemented basic approach as below. whats wrong inside our approach?
### project/schema class MySubscription(channels_graphql_ws.Subscription): notification_queue_limit = 64 event = graphene.String() class Arguments: arg1 = graphene.String() arg2 = graphene.String() @staticmethod def subscribe(root, info, arg1, arg2): return ["group42"] @staticmethod def publish(payload, info, arg1, arg2): return MySubscription(event="Something has happened!") class Subscription(graphene.ObjectType): my_subscription = MySubscription.Field()
### app/consumers.py import channels_graphql_ws from project.schema import schema class MyGraphqlWsConsumer(channels_graphql_ws.GraphqlWsConsumer): schema = schema # send_keepalive_every = 42 # strict_ordering = True async def on_connect(self, payload): print("New client connected!")
### project/asgi.py import os import channels from django.urls import path from django.core.asgi import get_asgi_application from app.consumers import MyGraphqlWsConsumer os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') django_asgi_app = get_asgi_application() application = channels.routing.ProtocolTypeRouter({ "http": get_asgi_application(), "websocket": channels.routing.URLRouter([ path("/graphql", MyGraphqlWsConsumer), ]) })
The text was updated successfully, but these errors were encountered:
I struggled with this for too long of a time. This is what worked for me. (notice no slashes in the graphql path)
websocket_urlpatterns = [ django.urls.re_path(r"graphql", MyGraphqlWsConsumer.as_asgi()), ] application = ProtocolTypeRouter({ "http": django_asgi_app, "websocket": channels.auth.AuthMiddlewareStack(channels.routing.URLRouter(websocket_urlpatterns)), })
hope it helps someone else.
Sorry, something went wrong.
No branches or pull requests
after handshake, we got this error.
Exception inside application: No route found for path 'graphql'.
we implemented basic approach as below. whats wrong inside our approach?
The text was updated successfully, but these errors were encountered: