I'm trying to connect to wss://csgoexo.com/socket.io/ using socket.io-client@2.4.0. I really don't understand what I'm doing wrong. Could you help me, I can pay for it, I'm seriously tired of this. I also used "ws" library - all the same. Code:
const Io = require("socket.io-client"); //2.4.0
async function wsConnect(){
const socket = Io('wss://csgoexo.com/socket.io/', {
transports: ["websocket"],
extraHeaders: {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36",
"Origin": "https://csgoexo.com"
}
});
socket.on('connect', () => {
console.log('Connected!', {id: socket.id});
});
// socket.on('close', (reason) => {
// console.log(reason)
// })
socket.on("disconnect", (reason) => {
console.log('Disconnected', reason)
if (reason === "io server disconnect") {
// the disconnection was initiated by the server, you need to reconnect manually
socket.connect();
}
// else the socket will automatically try to reconnect
});
socket.on("connect_error", (error) => {
console.log(error)
});
}
wsConnect();
https://www.piesocket.com/ - it works with this service. Error: 403. 'Unexpected server response: 403', CloseCode: 1006