No problem, I appreciate you taking the time to help! And yes the createUser mutation is working without any errors
Hmm that’s so strange! Have you tried the following order of operations?
Starting from the top:
- Run the
newUserCreated
subscription operation and it begins to “listen” for updates - Run the
createUser
mutation - The “listening”
newUserCreated
subscription receives and returns the new user
With this order of operations do you get any more interesting errors?
I figured out the problem and your first hunch was right. I had my graphql settings wrong under the subscriptions setting. The first screenshot I showed you I had the Subscriptions url set to “wss://localhost:3001/graphql” when it should have been “ws://localhost:3001/graphql”.
Awesome! I’m so glad you figured it out and it’s working.
Me too! Again thanks for taking the time to help!
Thanks, @StephenBarlow now it works, after weeks of reading and searching. this should be urgently included on the documentation page as a tip note. Also, this post should be labelled as solved so anyone who has the same issue can find it easily.
Hi I am experiencing a similar issue using the base example (https://github.com/apollographql/docs-examples/blob/main/apollo-server/v4/subscriptions-graphql-ws/src/index.ts). I have implemented exactly as is (copy & paste). I have tried using the ws and wss protocals on the apollo client. I am getting an error " Unable to reach subscription server". When I try to run the
npx diagnose-endpoint@1.1.0 --endpoint=ws://localhost:4000/graphQL
command it displays:
Diagnosing ws://localhost:4000/graphQL
Could not resolve (ENOTFOUND)
Is the address correct?
Is the server running?
Can someone please advise?