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

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

Meaning of memory wallet in web3.js

Updated August 31, 2017 16:28 PM