Closed yacine-bens closed 11 months ago
Sorry I totally forgot. I'll look at this in a few days. Also, coincidentally node.js 21 comes with an experimental browser-compatible websocket implementation 😛, so that's even better
Sounds great. I'll check it out.
I added a check so that it still uses the provided agent if it's running in node
In order to allow compatibility for both Nodejs and the browser with the same code, the following changes were made:
isomorphic-ws
export issue: setesModuleInterop
totrue
intsconfig.js
, and remove the curly brackets fromWebSocket
import inMsEdgeTTS.ts
WebSocket
constructor: takes only one argument (can't pass theagent
parameter)buffer
packageonopen
,onmessage
...)stream-browserify
,crypto-browserify
andprocess
To use this library with Webpack 5, edit
webpack.config.js
:webpack
at the top of the file:const webpack = require('webpack')