1

Why does my WebSocket connection always closes with 1006 error code, even when I use .close(1000) or .close(3000).

Interestingly, when using the WebSockets connection with Express.js and Express-ws, this does not happen, only when using our real API. Could it be something the server does? Isn't 1006 local only though?

Any help would be appreciated.

Thanks

2
  • I rather doubt we can help you without seeing your actual code that the error happens to, both client and server ends of the connection. Questions of the nature: "Why does my code do X?" must include that actual code. Commented Sep 5, 2016 at 15:31
  • I've actually tried and used ws://echo.websocket.org and that one works fine so it's most likely a server issue. Will close the question. Commented Sep 5, 2016 at 15:32

1 Answer 1

1

This answer says:

Close Code 1006 is a special code that means the connection was closed abnormally (locally) by the browser implementation.

If your browser client reports close code 1006, then you should be looking at the websocket.onerror(evt) event for details.

...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.