tomusdrw / rust-web3

Ethereum JSON-RPC multi-transport client. Rust implementation of web3 library. ENS address: rust-web3.eth
MIT License
1.45k stars 471 forks source link

Add `WebSockets: Reconnecting` #627

Open zzhengzhuo opened 2 years ago

zzhengzhuo commented 2 years ago

Hello. When I use websocket transport for a period, it will report WS connection error: Closed error. And I see that there is a feature WebSockets: Reconnecting & Pings in the doc which has not realized until now. Is there any plan for it? Thanks.

zzhengzhuo commented 2 years ago

I'd like to add reconnection for websockets, but I just think of one case:

Is there any other cases I should handle? Thanks for any guides.

zzhengzhuo commented 2 years ago

In my opinion, there should be three steps to do with connection error:

Any guides? @tomusdrw

I see https://github.com/ethers-io/ethers.js/issues/1053 using interval pings. But I think there may be some custom logic to do if a connection error happened.