Skip to content

Latest commit

 

History

History
115 lines (89 loc) · 5.43 KB

API.md

File metadata and controls

115 lines (89 loc) · 5.43 KB

Constants

rateLimitMethodsArray

Registers an array of method definitions to the rate limiter

rateLimitMethodBoolean

Registers a method for rate-limiting.

rateLimitPublicationsArray

Registers an array of publication definitions

rateLimitPublicationBoolean

Registers a publication for rate limiting

rateLimitAccounts

Rate-limits by default all builtin methods and publications. You can extend / override accountMethods and accountPublications

runRateLimiter

This finally runs through all registered methods/publications and internally adds the rules for each. Can perform a simple sanity check to see, if there is no non-rate-limited method or publication left. If you want the sanity check to be valid you should run this after all methods and publications and builtins have been registered for rate limiting.

rateLimitMethods ⇒ Array

Registers an array of method definitions to the rate limiter

Kind: global constant
See: {rateLimitMethod}

Param Description
methods an array of method definitions

rateLimitMethod ⇒ Boolean

Registers a method for rate-limiting.

Kind: global constant
See: https://docs.meteor.com/api/methods.html#DDPRateLimiter-addRule

Param Type Description
name String Name of the method
userId String | function | undefined optional The user ID attempting the method or subscription
connectionId String | function | undefined A string representing the user's DDP connection
clientAddress String | function | undefined The IP address of the user
numRequests Number number of requests allowed per time interval. Default = 10.
timeInterval Number time interval in milliseconds after which rule's counters are reset. Default = 1000.

rateLimitPublications ⇒ Array

Registers an array of publication definitions

Kind: global constant

Param Type Description
publications Array an array of publication definitions

rateLimitPublication ⇒ Boolean

Registers a publication for rate limiting

Kind: global constant
See: https://docs.meteor.com/api/methods.html#DDPRateLimiter-addRule

Param Type Description
name String Name of the method
userId String | function | undefined optional The user ID attempting the method or subscription
connectionId String | function | undefined A string representing the user's DDP connection
clientAddress String | function | undefined The IP address of the user
numRequests Number number of requests allowed per time interval. Default = 10.
timeInterval Number time interval in milliseconds after which rule's counters are reset. Default = 1000.

rateLimitAccounts

Rate-limits by default all builtin methods and publications. You can extend / override accountMethods and accountPublications

Kind: global constant

Param Type Description
numRequestsMethods Number number of requests allowed per time interval. Default = 10.
timIntervalMethods Number time interval in milliseconds after which rule's counters are reset. Default = 1000.
numRequestsPublications Number number of requests allowed per time interval. Default = 10.
timeIntervalPublications Number time interval in milliseconds after which rule's counters are reset. Default = 1000.
accountMethods Array list with strings of all builtin methods
accountPublications Array list with strings of all builtin publications

runRateLimiter

This finally runs through all registered methods/publications and internally adds the rules for each. Can perform a simple sanity check to see, if there is no non-rate-limited method or publication left. If you want the sanity check to be valid you should run this after all methods and publications and builtins have been registered for rate limiting.

Kind: global constant

Param Type Description
limitExceededCallback function function to be called if a rate-limit is exceeded at runtime
sanityCheck Boolean performs a sanity check before adding the rules
throwIfNotRatelimited Boolean throws an Error if any entry in Meteor.server.method_handlers or Meteor.server.publication_handlers is found that is not registered for rate limiting.