Unable to reach subscription server

Hi I am experiencing a similar issue than, Why subscription example from the official docs is not working correctly? - #27 by marcopieterse, using the base example (docs-examples/index.ts at main · apollographql/docs-examples · GitHub). 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
:warning: Could not resolve (ENOTFOUND)
Is the address correct?
Is the server running?

Can someone please advise?