Dat Nguyen
Sep 4, 2018 · 1 min read

Yes I have a similar issue. Web3 does not handle the disconnect gracefully, so I also had to handle reconnects in a similar fashion: I just call web3.setProvider(new Web3.providers.WebsocketProvider(‘wss://ropsten.infura.io/ws’));

Also for more robust solutions, I would used subscriptions rather than the raw event API.

Finally, There also is an alternate wss address that is more stable sometimes: wss://ropsten.infura.io/ws_

    Dat Nguyen

    Written by

    Software engineer, Blockchain enthusiast, Brazilian jiu-jitsu blackbelt.