import { io } from 'socket.io-client';
import { SocksProxyAgent } from 'socks-proxy-agent';

const agent = new SocksProxyAgent('socks5h://proxy.example:1080');
const socket = io('https://events.example', {
  agent,
  transports: ['polling', 'websocket'],
});

Use the actual Socket.IO service. The Node agent negotiates SOCKS; socks5h delegates destination DNS to that proxy. Use a matching endpoint from the SOCKS5 proxy list when public-service tests are permitted through public intermediaries.

Polling can succeed before a later WebSocket upgrade fails. Inspect both paths and any transportOptions overriding the top-level agent.

The example deliberately uses these two transports. WebTransport uses another implementation, and browser-bundled JavaScript follows browser configuration. A plain WebSocket endpoint is also not a Socket.IO server.

Keep existing events/reconnection logic, then disconnect the client and release its agent after connections finish.

Аффингæй хæстæг статьялтæ