title: How to watch for new records added to model in Sails.js
body: <p>I'm trying to push a message for when a user sends a message to a certain certain Id (within an User model) in a user to user chat messaging system. I can't get it to work, nor do I know how to get started. I have this in my <code>Messaging</code> controller: </p>
  
  <pre><code>sendAndReceiveMsgs: function(req, res) {
  
      if (req.isSocket &amp;&amp; req.param('message') &amp;&amp; req.param('to')) {
  
          var message = req.param('message'),
              from = req.user.id,
              to = req.param('to');
  
          Messaging.create({ message: message, from: from, to: to })
              .exec(function (err, created) {
                  console.log('sent');
          });
  
      } else if (req.isSocket) {
  
          Messaging.find({ where: { to: req.user.id }, limit: 1, sort: 'id DESC' })
          .exec(function(err, messages) {
              if(messages.length &gt; 0){
                  console.log(message.length + " new messages");
              } else {
                  console.log("No new messages");
              }
              Messaging.subscribe(req.socket, message);
              Messaging.watch(req);
              Messaging.publishCreate({ id: message[0].id, message: message[0].message });
          });
  
      } else if (!req.isSocket) {
  
          return res.notFound();
  
      }
  
  }
  </code></pre>
  
  <p>However, it doesn't push further new messages to the user (meant for him). Any clue? I really don't understand this, and don't know where to go from here. Thanks!</p>