Open Liang-YY opened 1 year ago
Maybe someone will find it useful
const HttpsProxyAgent = require("https-proxy-agent");
const WebSocket = require("ws");
const ReconnectingWebSocket = require("reconnecting-websocket");
const wsUrl = "wss://some.url";
const agent = new HttpsProxyAgent("http://ip:port");
class WebSocketWithAgent extends WebSocket {
constructor(url, protocols) {
super(url, protocols, {
agent,
});
}
}
const ws = new ReconnectingWebSocket(wsUrl, [], { WebSocket: WebSocketWithAgent });
How to set proxy?