RateLimiter

interface RateLimiter

Controls request throughput to stay within PUBG API rate limits.

The PUBG API enforces a default limit of 10 requests per minute per API key. Exceeding this results in an HTTP 429 response.

Implement this interface to provide custom throttling behaviour and pass the implementation to the dev.pubgkt.PubgApi constructor. The default implementation is DelayRateLimiter, which proactively delays requests based on response headers.

To disable rate limiting entirely (e.g. when you manage it externally), use RateLimiter.None.

See also

Inheritors

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract fun onResponse(limit: Int?, remaining: Int?, reset: Long?)

Called after every response to update internal state from rate-limit headers. Any parameter may be null if the corresponding header was absent.

Link copied to clipboard
abstract suspend fun throttle()

Called before each outbound request. Implementations should suspend here if the rate limit has been (or is about to be) reached.