问题描述
我知道客户端 _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
}
);
推荐答案
目前在 Meteer 中没有内置支持,但它在路线图上 https://trello.com/c/SYcbkS3q/18-dos-hardening-rate-limiting
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
这篇关于您如何限制服务器端的呼叫?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!