faye-websocket exposes a proxy option on its Client constructor. Pass it before the connection starts:

const WebSocket = require('faye-websocket');

const socket = new WebSocket.Client(
  'wss://service.example/socket',
  [],
  { proxy: { origin: 'http://proxy.example:8080' } },
);
socket.on('error', error => console.error(error.message));

The first URL identifies the WebSocket service. proxy.origin identifies the HTTP intermediary. For an allowed public WSS test with no proxy credentials, the HTTP proxy list offers addresses for that origin; verify access to the actual WebSocket endpoint. The library documents origin as the required proxy option and also supports proxy-specific headers and TLS configuration.

The empty array is the subprotocol list, not a proxy list. Supply application subprotocol names there when the service requires them.

This configures the Faye client created by the code. If another SDK owns the WebSocket, use an SDK-supported path for supplying its connection options. Creating this separate socket does not alter the SDK's existing connection.

Artihkkalat mat laktásit