Skip to content

Conversation

@aspandey
Copy link

@aspandey aspandey commented Nov 7, 2024

Prep PR for node 22

In node v22, websocket is enabled by default
nodejs/node#51594

This will cause an error on following line when the global.Websocket would be true.
const WS = global.WebSocket || require('ws');

global.WebSocket: This will points to Node.js's native WebSocket, which does not include a Server class.
require('ws'): The ws package includes both WebSocket and WebSocket.Server, but this fallback is skipped because global.WebSocket is already defined in Node.js v22

Copy link
Contributor

@naveenpaul1 naveenpaul1 left a comment

Choose a reason for hiding this comment

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

LGTM

In node v22, websocket is enabled by default
nodejs/node#51594

This will cause an error on following line when the global.Websocket
would be true.
const WS = global.WebSocket || require('ws');

global.WebSocket: This will points to Node.js's native WebSocket,
which does not include a Server class.
require('ws'): The ws package includes both WebSocket and
WebSocket.Server, but this fallback is skipped because global.WebSocket
is already defined in Node.js v22

Signed-off-by: Ashish Pandey <aspandey@redhat.com>
@aspandey aspandey force-pushed the remove_global_websocket branch from 5de427b to ee6cf99 Compare November 10, 2024 14:13
@aspandey aspandey merged commit fc266c3 into noobaa:master Nov 10, 2024
@aspandey aspandey deleted the remove_global_websocket branch November 10, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants