Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket onclose event not enabled #4587

Open
valeriivanchev opened this issue Feb 9, 2024 · 2 comments
Open

Websocket onclose event not enabled #4587

valeriivanchev opened this issue Feb 9, 2024 · 2 comments
Assignees
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6

Comments

@valeriivanchev
Copy link

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

@valeriivanchev valeriivanchev added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels Feb 9, 2024
@valeriivanchev valeriivanchev changed the title Add Bug Title Here Websocket onclose event not enabled Feb 9, 2024
@ricmoo
Copy link
Member

ricmoo commented Feb 9, 2024

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.

@valeriivanchev
Copy link
Author

Perfect thanks for the quick update. Just one more question when is the next minor release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6
Projects
None yet
Development

No branches or pull requests

2 participants