I'm studying the SailsCasts and I'm working on SailsJS beta version 0.10.
Everything works except when in 0.9.7, I use this:
//subscribe this socket to the User model classroom
User.subscribe(req.socket);
// subscribe this socket to the user instance rooms
User.subscribe(req.socket, users);
- How to do this for 0.10?
Especially, the subscribe for publishUpdate
and publishDestroy
works fine.
For publishCreate
, I need 'User.subscribe(req.socket)'
and I have in console the warning:
debug: Deprecated: Model.subscribe(socket, null, ...)
debug: (see http://links.sailsjs.org/docs/config/pubsub)
debug: Please use instance rooms instead (or raw sails.sockets.*() methods.)
And then:
- What are the differences between
'model.watch()'
and'model.subscribe()'
?