My contract is deployed on ropsten infura test-network and that contract has events which gets fired when there is some transaction.

contract file

function functionName(address from, address destination, uint256 amount) stoppable public {
        myEvent(from, destination, amount);

I am trying to listen this event in my node js code in below manner

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

Contract.events.myEvent(function (err, res) {
      if (!err) {
        console.log('Event Log :', res);

After restarting node server and doing instant transactions which calls method "functionName" from contract which emits event, node js is properly listening for the events and I am getting expected output.

But if I wait 5 min or more idle without making any transactions or any activity and if I make transaction after that interval the method from contract "functionName" is getting called but node js is not able to listen for that event.

Can any one please let me know if you face such issues ever.

  • I'm having this problem as well. Did you find the solution?
    – Kise
    Mar 30, 2021 at 16:22

1 Answer 1


Try using a different rpc endpoint . Some examples are Alchemy , getblocks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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