Web3.js How to keep Websocket subscriptions alive and reconnect on failures
Smart contracts are an essential part of the Ethereum ecosystem; Smart contracts emit so-called events when something meaningful happens within the smart contract that the smart contract wants to communicate to dApps and other smart contracts.
I want to share with you some ways for keeping the Websocket connection open while listening to smart contract events. Some smart contracts don’t emit events so often, therefore, you can configure your Infura Websocket to stay alive even though the smart contract is not constantly emitting events.