You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
I am making a websocket connection to Infura Ropsten wss://ropsten.infura.io/ws
and then making contract event subscription like so contract.events.MyEvent() .on('data', function(event) { console.log('Event Generated', data) }) .on('error', function(error) { console.log('Event Error', error) })
Infuras websockets seem to be unstable and drop randomly. Unfortunately the websocket drops silently in the background and my event never receives the error. My app just continues to work and stops receiving event data.
I can tell that websocket drops by running setInterval on web3.eth.net.isListening()
Is there a graceful way to catch the websocket drop and reconnect immediately? If not what is a safe interval to run isListening on?