could not connect to websocket endpoint ws://localhost:4000/graphql. please check if the endpoint url is correct.

The it turns out that Firefox has issues with websockets (see this bug report that has been re-appeared even after the supposed fix).

In Firefox it works directly after starting a novel browser but after some hot reloading it stops working. The following helps out with starting out fresh but not with the reloading issue:

const wsLink = new WebSocketLink({
  uri: SUBSCRIPTION_URI,
  options: {
    reconnect: true,
    timeout: 20000,
    lazy: true,
  },
});

window.addEventListener('beforeunload', () => {
  // @ts-ignore - the function is private in typescript
  wsLink.subscriptionClient.close();
});
I think the bug is related to this SO-question: "websocket was interrupted while page is loading" on Firefox for Socket.io

If you want to test different solutions I've created an example repo: https://github.com/gforge/subscription_example that works both by itself and with a Docker container.

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
Could not connect to websocket endpoint ws://localhost:4000/graphql. "Could not connect to websocket endpoint ws://localhost:4000/graphql. Please check if the endpoint url is correct." } Could not connect to websocket endpoint ws://localhost:3006/graphql. Please check if the endpoint url is correct. Could not connect to websocket endpoint ws://localhost:3050/graphql. Please check if the endpoint url is correct. Could not connect to websocket endpoint ws://localhost:4000/. Please check if the endpoint url is correct. "Could not connect to websocket endpoint ws://localhost:4000/graphql. Please check if the endpoint url is correct." Could not connect to websocket endpoint ws://api.localhost/graphql Could not connect to websocket endpoint ws://localhost:3000/api/subscriptions. Please check if the endpoint url is correct. site:stackoverflow.com "Could not connect to websocket endpoint ws://localhost:3000/api/subscriptions. Please check if the endpoint url is correct." nextjs Could not connect to websocket endpoint ws://localhost:3000/graphql. Please check if the endpoint url is correct." Could not connect to websocket endpoint ws://localhost:3000/graphql. Please check if the endpoint url is correct." Could not connect to websocket endpoint ws://localhost:4000/ws/. Please check if the endpoint url is correct. { "error": "Could not connect to websocket endpoint ws://localhost:1337/graphql. Please check if the endpoint url is correct." } Could not connect to websocket endpoint ws://localhost:13 "error": "Could not connect to websocket endpoint ws://localhost:4000/subscriptions. Please check if the endpoint url is correct." apollo server graphql ws Could not connect to websocket endpoint ws://localhost:5000/graphql. Please check if the endpoint url is correct. Could not connect to websocket endpoint ws://localhost:5000/graphql. Please check if the endpoint url is correct. fix Could not connect to websocket endpoint ws://localhost:8080/graphql. Please check if the endpoint url is correct. Could not connect to websocket endpoint ws://localhost:3000/graphql Could not connect to websocket endpoint ws://localhost:8080/graphql. Please check if the endpoint url is correc "error": "Could not connect to websocket endpoint ws://localhost:3000/graphql. Please check if the endpoint url is correct." Could not connect to websocket endpoint ws. Please check if the endpoint url is correct. Could not connect to websocket endpoint ws://api.localhost/graphql. Please check if the endpoint url is correct. Could not connect to websocket endpoint ws://localhost/graphql. Please check if the endpoint url is correct. Could not connect to websocket endpoint wss://api.ginbang.com/frontend/ws. Please check if the endpoint url is correct. { "error": "Could not connect to websocket endpoint ws://localhost:8000/graphql. Please check if the endpoint url is correct." } could not connect to websocket endpoint ws://localhost:4000/graphql. please check if the endpoint url is correct.
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source