The following seems to poll my Ethereum node every second:


Is there a way to decrease the polling interval?

  • why dont you use watch or subscribe via websocket then you dont need to poll anymore?
    – Ha ĐANG
    Sep 27 '18 at 4:57
  • There is not. :(
    – Motoma
    Sep 28 '18 at 19:09

Indeed you need to use WebsocketProvider, it gives you opportunity to receive notification instantly after node synchronization.

var web3 = new Web3(new Web3.providers.WebsocketProvider('wss://ropsten.infura.io/ws'));

var myContract = new web3.eth.Contract(<abi>, <address>);
myContract.events.allEvents({ fromBlock: 'latest' }, console.log);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.