cazala / coin-hive

CoinHive cryptocurrency miner for node.js
https://www.npmjs.com/package/coin-hive
MIT License
1.99k stars 399 forks source link

Setting the port and host in the script #25

Closed nodevm closed 7 years ago

nodevm commented 7 years ago

I have the following node script

const CoinHive = require('coin-hive');

(async () => {

  // Create miner
  const miner = await CoinHive('longkey'); // Coin-Hive's Site Key

  // Start miner
  await miner.start();

})();

//port and host

and i am running the script like

node script.js and it runs but that takes port 127.0.0.1:3002

I want to have another instance of the script that runs on port 3003. How would i indicate that in the script that i want this to run on port 3003?.

cazala commented 7 years ago
const CoinHive = require('coin-hive');

(async () => {

  // Create miners
  const miner1 = await CoinHive('site-key', { port: 3002 });
  const miner2 = await CoinHive('site-key', { port: 3003 });

  // Start miners
  await miner1.start();
  await miner2.start();

})();