vtortola / WebSocketListener

A lightweight and scalable asynchronous WebSocket listener
http://vtortola.github.io/WebSocketListener
313 stars 85 forks source link

How to bypass CORS? #129

Open hvta opened 6 years ago

hvta commented 6 years ago

I'd like to use the WS listener with socket.io on the client side (where the WS and HTTP servers are under different domains). I get a message saying thet Access-Control-Allow-Origin header is not set. How can it be set on the srver side?

vtortola commented 6 years ago

You can hook into the HTTP negotiation with https://github.com/vtortola/WebSocketListener/wiki/Hooking-into-the-HTTP-negotiation

However, as far as I remember, socket.io is more than just a websocket. In the other hand, this component is pure raw websocket protocol, no fallback to other transports.