I'm having trouble using sails.io.js with angular2. I use the angular2-sails library.
First I decided to use with a code inside my app.component.ts
this._sailsService.connect(this.url);
It works but when I launched the app I also have those messages "Socket is trying to reconnect to Sails.." I checked, it's trying to connect to port 4200.
I used sails.io.js with
"scripts": ["sails.io.js"]
in angular-cli.json. But I tried something else :
<script src="sails.io.js"> // I also tried src="src/sails.io.js
</script>
<script type="text/javascript">
io.sails.useCORSRouteToGetCookie = false;
io.sails.url = 'http://localhost:1337';
</script>
in index.html, and my browser returns that it cannot load the script at "http://localhost:4200/sails.io.js" or "http://localhost:4200/src/sails.io.js"
folders :
app.js
angular-cli.json
src
-index.html
-sails.io.js
-app
--app.component.ts
I don't know why it tries to connect to 4200 when it's called in the angular-cli.json and why it can't access my sails.io.js when called in the index.