Websocket `onclose` event not enabled
Ethers Version
6.8.1
Search Terms
No response
Describe the Problem
Infura closes the idle websocket connections and we want to reconnect after that. The problem is that in the WebSocketProvider implementation of ethers the onclose handler is commented out and not a part of the WebSocketLike interface. To fix this issue we need to do a workaround. Can you enable onclose handler or is it planned an actual reconnect implementation out of the box?
Code Snippet
No response
Contract ABI
No response
Errors
No response
Environment
No response
Environment (Other)
No response
It is planned (in the next minor release) to automatically reconnect, resubscribe and backfill events.
In the meantime though, you can add the listeners to the WebSocket before passing it to the WebSocketProvider. The limitations on the wrapped socket are intentional so other socket-like things can be done with minimal implementations.
I’ll update this issue as the resubscribe is implemented.
Perfect thanks for the quick update. Just one more question when is the next minor release?
Hi @ricmoo is there an update regarding the issue?
Hello, any news on this?
@ricmoo when is this update done?
@ricmoo Could you give an update regarding this issue?