1

I have gone through some websites and found that it is not posssible to add headers while usig web socket.Is that true

I have to pass the origin header as Origin : "http://localhost:4200"

1 Answer 1

1

The Origin header is not in control of the Javascript running on a page. It is set by the browser, without control of the web application running in the browser. This is not only the case for Websockets but for any HTTP requests from the browser.

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

4 Comments

May I know whether the websocket work fine on https that my websocket is working fine on http.But while changing it to https,it is not working.In the message I am getting length as N/A.and data as empty
@user20925233: This does not seem directly related to your question and I don't have enough details to answer this. I recommend that you create a new question with all the details needed to understand and reproduce your problem.
I asked this question in the above link

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.