Script with web3.eth.getAccounts() never ends

by sapiensapiens   Last Updated January 11, 2019 12:28 PM

I have a little script just with the following function:

const Web3 = require('web3');
var web3Provider = new Web3(new Web3.providers.WebsocketProvider('ws://'));
const web3 = new Web3(web3Provider);

web3.eth.getAccounts().then(e => console.log(e));

But when I receive the callback, the script is never closed, it continues running (doing nothing). How can I stoped it? why it happens?

Related Questions

miner.start() is not a function?

Updated June 05, 2019 13:28 PM

Creating new account from web3 showing error

Updated April 16, 2018 14:28 PM

how to import UTC-JSON file through web3-eth methods

Updated October 17, 2018 13:28 PM