Looks like it's easy to add custom HTTP headers to your websocket client with any HTTP header client which supports this, but I can't find how to do it with the JSON API.
Yet, it seems that there should be support these headers in the spec.
Anyone has a clue on how to achieve it?
var ws = new WebSocket("ws://example.com/service");
Specifically, I need to be able to send an HTTP Authorization header.
Totally hacked it like this, thanks to kanaka's answer.
Client:
Server (using Koa2 in this example, but should be similar wherever):
You cannot add headers but, if you just need to pass values to the server at the moment of the connection, you can specify a query string part on the url:
That URL is valid but - of course - you'll need to modify your server code to parse it.