7

I need to access the response header from a javascript websocket connection. Is there any way to access these response header? Or at least the response code?

I only have access to the event of onclose, onerror, onopen with a few (unusable - for my purposes) properties!

1 Answer 1

7

You can't. There is no functionality for that at the moment. The point of WebSockets is not HTTP communication. HTTP is only used for the handshake.

https://developer.mozilla.org/en-US/docs/Web/API/WebSocket

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

2 Comments

Ok, thanks for that quick response! And who specifies the code from the closeEvent? The Server? Or Browser?
The websocket server implementation

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.