Closed alexmayerlab closed 4 years ago
CORS is useful when connecting via HTTP only. With web sockets, if you connect via HTTP, the HTTP connection will attempt to upgrade to a web socket connection. With socket IO, it uses a polling transport first (via HTTP), and then it switches to a web socket transport if it is able.
I have added CORS support, but I think it's pretty much useless unless I also expose the HTTP server for uses other than web sockets. You can enable this new functionality by pulling the latest from the GitHub repo and adding "enableCORS" to your config. Give it a value equal to the domain that your client application is being delivered from...but like I say -- pretty sure it's useless.
Here's how you might actually fix your problem -- in your client code, make sure you've specified that your client will only communicate over a web socket transport.
socket = io.connect(socketUri, { transports: ['websocket'] });
If you're not sure what I mean, check the sample app: https://github.com/ambelovsky/gosf-sample-app
Or review the code sample in this part of the docs: http://gosf.io/#your-first-client
Maybe you should add the ability to specify cors ?