fix: proxy is not a constructor

#833 #656
This commit is contained in:
Elysia 2023-09-02 21:10:00 +07:00
parent 90bab11bc8
commit c152c0a814

View File

@ -281,7 +281,7 @@ class WebSocketShard extends EventEmitter {
let args = { handshakeTimeout: 30_000 };
if (client.options.proxy.length > 0) {
const proxy = require('proxy-agent');
args.agent = new proxy(client.options.proxy);
args.agent = new proxy.ProxyAgent(client.options.proxy);
this.debug(`Using proxy ${client.options.proxy}`, args);
}
// Adding a handshake timeout to just make sure no zombie connection appears.