3
votes

I trying to connect to the non-socket.io websocket server using socket.io client. But I can't to do it. I'm trying to connect to socket server like this:

var socket = io.connect('wss://url-to-socket-api/');

And getting the error:

XMLHttpRequest cannot load https://url-to-socket-api/socket.io/?EIO=3&transport=polling&t=1452852826678-0. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.33.10' is therefore not allowed access. 

But when I connect to the server with web socket API like this:

var socket = new WebSocket('wss://url-to-socket-api');

It's works.

Is it possible to use socket.io client with non-socket.io server?

1

1 Answers