title: Meteor: Limiting DDP Connections with ddp-rate-limiter package
body: <p>I am trying to prevent a user to be able to call a Meteor method too often with the Meteor package <code>ddp-rate-limiter</code> (For example to prevent spamming or a DOS attack), but I can not get it to work. </p>
  
  <p>Does anybody have an idea? </p>
  
  <p>server/ddpRateLimiter.js:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Meteor.methods({
    dosAttack: function() {console.log("dos");}
  });
  
  var preventDosAttack= {
    userId: function() {return true;},
    type: 'method',
    method: 'dosAttack'
  }
  
  DDPRateLimiter.addRule(preventDosAttack, 5, 1000);</code></pre>
  </div>
  </div>
  </p>
  
  <p>With this code I can still run the method from the client console as often as I want to. (Tested with a for loop 100 times)</p>
  
  <p>You can find the entire sourcecode here: <a href="http://github.com/minden/gotit" rel="nofollow">opensource project</a></p>
  
  <p>And this certain commit here: <a href="https://github.com/minden/GotIt/tree/667319d9da1be2dbb9450afc5a0a137f86767ceb" rel="nofollow">commit</a></p>
  
  <p>Thank you very much for your help, </p>
  
  <p>Max</p>