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

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

问题描述

我知道客户端 _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

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

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