sails-angular2 icon indicating copy to clipboard operation
sails-angular2 copied to clipboard

Nothing happens with the on method

Open Hamashi opened this issue 7 years ago • 0 comments

Hello, I would like to use sails.io.js with angular5, so I used angular2-sails module. I managed to connect angular to sails BUT I didn't manage to retrieve the events from sails.js, for example when a new document is created in database. Is there something to configure sails side ? I used this.sailsService.on("user").subscribe(data => console.log("event on user")). The get and post methods are perfectly working. Sails side I put

 ioclient:  require('socket.io-client')('http://localhost:1337'),
io: require('sails.io.js'),

In config/http.js, instead of var io = require('sails.io.js')( require('socket.io-client') );

because sails cannot load else I didn't write anything in config/socket.js

Did I make something wrong so I can't get the event ?

Hamashi avatar Jan 04 '18 12:01 Hamashi