Open tschellenbach opened 2 weeks ago
If I am not mistaken,It seems that the globalThis.WebSocket reference isn’t functioning as expected in Node.js version 22.4.0 and later. This issue might be due to changes in how Node handles globalThis.WebSocket.
Conditional Loading of WebSocket: If globalThis.WebSocket is undefined, we can manually require the WebSocket module:
if (typeof globalThis.WebSocket === 'undefined') { globalThis.WebSocket = require('ws'); }
Had this issue with v22.2.0
too. Ended up downgrading for the demo.
Same issue in bun & deno
See https://nodejs.org/api/globals.html#websocket
The if statement in api.js globalThis.WebSocket doesn't work as intended in recent node versions.