Skip to content

Commit 0467c41

Browse files
Rollback ws change on x-ws (#1980)
1 parent 0950950 commit 0467c41

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

packages/x-ws/src/node.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,4 @@ import { extractGlobal } from '@polkadot/x-global';
77

88
export { packageInfo } from './packageInfo.js';
99

10-
/**
11-
* The built-in `globalThis.WebSocket` in Node.js 22+ does not provide
12-
* detailed error messages (e.g., `ECONNREFUSED` or `ETIMEDOUT`), making
13-
* it difficult to implement proper reconnection logic.
14-
*
15-
* To avoid these issues, we explicitly use the `ws` library in Node.js 22+
16-
* while still preserving support for the browser WebSocket API in browser environments.
17-
*
18-
* Related Issue: https://github.com/polkadot-js/common/issues/1975
19-
*/
20-
const isNode22 = typeof process !== 'undefined' && parseInt(process.versions?.node?.split('.')[0] || '0', 10) >= 22;
21-
22-
export const WebSocket = isNode22 ? (ws as unknown as typeof globalThis.WebSocket) : /*#__PURE__*/ extractGlobal('WebSocket', ws);
10+
export const WebSocket = /*#__PURE__*/ extractGlobal('WebSocket', ws);

0 commit comments

Comments
 (0)