Skip to content

Commit 5de427b

Browse files
committed
noobaa/core: remove global websocket
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 <[email protected]>
1 parent a7c133e commit 5de427b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/rpc/rpc_ws.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Copyright (C) 2016 NooBaa */
22
'use strict';
33

4-
const WS = global.WebSocket || require('ws');
4+
const WS = require('ws');
55

66
const dbg = require('../util/debug_module')(__filename);
77
const http_utils = require('../util/http_utils');

src/rpc/rpc_ws_server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const url = require('url');
55
const EventEmitter = require('events').EventEmitter;
66
const RpcWsConnection = require('./rpc_ws');
77
const dbg = require('../util/debug_module')(__filename);
8-
const WS = global.WebSocket || require('ws');
8+
const WS = require('ws');
99

1010

1111
/**

0 commit comments

Comments
 (0)