I'm building some testing tool for SocketIO, that will allow a user to connect to any SocketIO back-end.
When i try connecting to a different domain, i get the CORS error, as expected.
Being that i do not control the server side in this case, the standard solution of adding headers is irrelevant.
Is there any way to overcome it on the front side, whether through SocketIO itself, or just plain JS?
This is the basic code i'm using to connect, when my React component mounts:
connect = (address) => {
console.log('connecting');
this.setState(()=>({
connectionStatus:'connecting'
}))
if (socket) {
socket.disconnect();
}
socket = window.socket = io(address);
socket.on('connect', () => {
console.log('connected!')
this.setState({
connectionStatus: 'connected',
})
});