如何限制服务器端的通话? [英] How can you throttle calls server side?

查看:94
本文介绍了如何限制服务器端的通话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道客户端_underscore.js可用于限制点击率,但是如何限制服务器端的通话?我曾想过使用相同的模式,但不幸的是_throttle似乎无法区分Meteor.userId().

I know client side _underscore.js can be used to throttle click rates, but how do you throttle calls server side? I thought of using the same pattern but unfortunately _throttle doesn't seem to allow for differentiating between Meteor.userId()'s.

Meteor.methods({
  doSomething: function(arg1, arg2){
    // how can you throttle this without affecting ALL users
  }
);

推荐答案

目前流星尚没有内置对此功能的支持,但它在路线图上

there is not built in support for this currently in meteor, but its on the roadmap https://trello.com/c/SYcbkS3q/18-dos-hardening-rate-limiting

理论上,您可以在此处使用某些选项限制方法会在N秒内调用M个请求,但是您必须推出自己的解决方案

in theory you could use some of the options here Throttling method calls to M requests in N seconds but you would have to roll your own solution

这篇关于如何限制服务器端的通话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆