yearn / seafood

Seafood
https://seafood.yearn.watch
13 stars 21 forks source link

Websocket connectivity fixes #63

Closed murderteeth closed 2 years ago

murderteeth commented 2 years ago

Intermittently the app can't establish new wss connections

We've noticed this while developing. Reviewing the app's network connections showed a lot of extra\unused websockets being opened. This PR cleans those up, the idea being that maybe the rpc servers are limiting socket count per client. (It's also just good to cleanup the extra sockets of course!)

If the app isn't used for 60 seconds, established websockets "timeout" and close

The problem here seems to be the rpc servers terminating sockets after one minute of no activity. We're using ethersjs for our rpc client which doesn't currently have logic to auto-reconnect closed sockets (https://github.com/ethers-io/ethers.js/issues/1053). So for now, I added a "keepAlive" function that requests the current block number every 55 seconds.

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
seafood ✅ Ready (Inspect) Visit Preview Jun 8, 2022 at 6:16AM (UTC)