Answer the question
In order to leave comments, you need to log in
How to run a Node.js WebSockets script under different proxies?
I understand how to fully configure the entire Node.js so that it comes under Proxy. Is it possible somehow to assign a separate Proxy server to each copy of the running script and so that it goes through it?
ADD: There is a js script written in Nodejs + https://github.com/websockets/ws . The task is to run a copy of the script, but so that the connection is through a third-party specified proxy, available technologies on the HTTP/HTTPS/SOCKS4,5 proxy
Answer the question
In order to leave comments, you need to log in
We take out the proxy address into a variable, then, if desired, we calculate this variable depending on the environment or on the parameters passed
var proxyAddress = process.env.PROXY_ADDRESS;
// node app.js --proxy_address='...'
var proxyAddress = process.argv[2].split('=')[1];
child_process.fork('app.js', '--proxy_address=...');
child_process.fork('app.js', {
env: {
PROXY_ADDRESS: '...'
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question