Following the examples in: http://sailsjs.com/documentation/reference/web-sockets/resourceful-pub-sub
// listen to thing events
io.socket.on('thing', function (msg) {
console.log('thing msg',msg);
});
// subscribe to thing
io.socket.get('/thing', function(resData, jwres) {
console.log(resData);
});
I find that Rest routes and Shortcut routes do generate resourceful events. (i.e. get /thing/create?name=hello
)
But, when I call these from the server side, the resourceful events are not generated.
Thing.create(), Thing.update(),...
Is this normal?
Is there a way to turn it on?
Otherwise, how would I generate events that would be picked up by the model subscription that are equivalent to to those generated by the CRUD actions?
I noticed there are Life Cycle callbacks and publishAdd(), publishUpdate(), functions that can generate the appropriate events for a model. But, is there something that can be turned on that will cause a model to automatically generate upon upon Thing.create(), Thing.update(), Thing.destroy(), etc.?
Thanks.