Closed Pet3ris closed 3 years ago
Hi @Pet3ris,
Which ASGI server are you using?
If you are using Uvicorn, you need to install the websockets
or uvicorn[standard]
package.
pip3 install websockets
@ciscorn yeah I'm using uvicorn[standard]
:
uvicorn = {extras = ["standard"], version = "^0.13.4"}
starlette = "^0.14.2"
starlette-graphene3 = "^0.3.0"
I'm launching the server with:
uvicorn --reload --port 5000 src:app
@Pet3ris
I've added playground_options
parameter to starlette-graphene3==0.3.2
, which allows you to do something like this:
GraphQLApp(schema, playground=True, playground_options={"subscriptionEndpoint": "/graphql-ws"})
Wow that immediately works:
Appreciate the blitz release!
Hi There,
I'm using the following code to run a websocket GraphQL endpoint:
How do I now debug the new websocket route in the playground?
1.
Opening up playground with
localhost:5000/graphql-ws
doesn't work2.
Opening up playground with
localhost:5000/graphql
works but then when running the subcription, it's attempting to connect to the server on the incorrect route (/graphql
).Any thoughts on how to figure out if the websocket endpoint is working?