8000 Fix: Use ws library in Node.js 22+ for Better WebSocket Error Handling by valentinfernandez1 · Pull Request #1976 · polkadot-js/common · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix: Use ws library in Node.js 22+ for Better WebSocket Error Handling #1976

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

Merged
merged 2 commits into from
Feb 12, 2025

Conversation

valentinfernandez1
Copy link
Contributor

Addresses #1975. Starting from Node.js 22, the built in WebSocket implementation does not provide detailed error messages (e.g., ECONNREFUSED, ETIMEDOUT). This can cause issues when handling disconnections and reconnections in polkadot-js/api, as the errors are too generic to detect connection failures properly.

This PR forces the use of the ws library in Node.js 22+. This temporarily fixes the issue, until the Node.js native WebSocket become mature enough to handle such errors.

TarikGul
TarikGul previously approved these changes Feb 12, 2025
Copy link
Member
@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks amazing, just one nit! 🚀

Copy link
Member
@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@TarikGul TarikGul merged commit 5b27490 into master Feb 12, 2025
4 checks passed
@TarikGul TarikGul deleted the patch/web-socket-nodejs-22 branch February 12, 2025 20:09
@polkadot-js-bot
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Feb 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0