I'm writing an application that connects to a sails
server.
This application is written with cordova
, angularJS
and Ionic
.
When I launch my application in my browser (with ionic serve
) the socket fails to connect to the server. Here is the message I get:
GET http://localhost:8100/socket.io/?__sails_io_sdk_version=0.11.0&__sails_io_s…sails_io_sdk_language=javascript&EIO=3&transport=polling&t=1443472067762-4 404 (Not Found)
The server is running locally on port 1337. I tried to change the above URL to:
http://localhost:1337/socket.io/?__sails_io_sdk_version=0.11.0&__sails_io_s…sails_io_sdk_language=javascript&EIO=3&transport=polling&t=1443472067762-4
and it's working.
In my code I set the URL after sails.io.js
has been included:
io.sails.url = 'http://localhost:1337';
io.sails.useCORSRouteToGetCookie = false;
Why is it asking to localhost:8100
and not localhost:1337
?
When I launch this application in my mobile device (setting the url to http://192.168.1.10:1337
) it's working correctly.
Version of sails.io.js
is 0.11.6
, and version of sails
is 0.11.0