Estoy tratando de conectarme a wss://csgoexo.com/socket.io/ usando socket.io-client@2.4.0. Realmente no entiendo lo que estoy haciendo mal. Me podrían ayudar, puedo pagarlo, estoy seriamente cansado de esto. También usé la biblioteca "ws", de todos modos. Código:
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/ - funciona con este servicio. Error: 403. 'Respuesta inesperada del servidor: 403', CloseCode: 1006