socks5-https-client
socks5-https-client copied to clipboard
Is it possible to use this Agent with socket.io library?
I'm trying to use this Agent with socket.io-client library
require("dotenv-safe/config")
const io = require("socket.io-client")
const Agent = require("socks5-https-client/lib/Agent")
const agentOptions = {
socksHost: process.env.HOST,
socksPort: process.env.PORT,
socksUsername: process.env.USERNAME,
socksPassword: process.env.PASSWORD
}
const agent = new Agent(agentOptions)
const socket = io(HTTPS_URL, {
agent,
transports: ["websocket"]
})
socket.on("connect", () => {
console.log("connect")
})
But it fails with error stack:
_http_client.js:468
socket._readableState.flowing = null;
^
TypeError: Cannot set property 'flowing' of undefined
at Socks5ClientSocket.socketOnData (_http_client.js:468:37)
at emitOne (events.js:115:13)
at Socks5ClientSocket.emit (events.js:210:7)
at TLSSocket.<anonymous> (/Users/serge/repos/pt/pt-4/node_modules/socks5-client/lib/Socket.js:137:8)
at emitOne (events.js:115:13)
at TLSSocket.emit (events.js:210:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at TLSSocket.Readable.push (_stream_readable.js:208:10)
at TLSWrap.onread (net.js:595:20)
I'm sure in my settings for proxy, I've tested it with curl
and request
library and it works.
What version of socket.io-client are you using?