Can a websocket client in a browser send headers?
<p>There is a debate raging in the office about a browsers ability to send handshake headers are part of establishing a websocket connection.</p>
<p><a href="https://www.rfc-editor.org/rfc/rfc6455#page-6" rel="nofollow noreferrer" title="In this spec">The websocket spec</a> makes it clear that headers are possible. And, infact, in my non-browser client code I do set handshake headers and they are received without and issue.</p>
<p>The open debate is: Can a web browser using javascript insert headers are part of the handshake? The spec seems to indicate there is nothing against it but no one can find client side documentation that says how.</p>
<p>There is a lot of conflicting information. It's obviously possible because I am able to do it in Java without a problem. But for Javascript no one is seeing how. Is it a browser restriction?</p>
<p>To clarify how my question is different than others: Is the inability to do this a limitation of the default javascript libs? The web browser or the spec? It looks like it's a library limitation only</p>