As of 2024 you can pass any http/s.request options to the websocket constructor.
See: https://github.com/websockets/ws/issues/2074
const ws = new WebSocket(url, { headers: { foo: 'bar' } });