Ga naar de inhoud
InstaPlay
Onderdelen van de SDK-documentatie

SDK errors and limits

An SDK error is an Error with code, retryAfterMs?, details?. Check it with InstaPlay.isError(e):

try {
  await InstaPlay.saves.set('progress', data)
} catch (e) {
  if (InstaPlay.isError(e) && e.code === 'offline') showToast('We will save when back online')
}

Codes

Code When
not_initialized a call before init
timeout no reply in 10 s (ads.interstitial/ads.rewarded — in 150 s, player.login — in 16 min)
offline no network (saves stay buffered)
unavailable the server is unavailable; for player.login() also “the portal has no sign-in methods right now”
session_expired the game session expired and could not be renewed
rate_limited too often; retryAfterMs — when to retry
version_conflict the save was changed elsewhere and your write lost to the cloud: the server did not confirm its base during this page load, or the key has not been read again after losing (see "Cloud saves"); details.version, details.updatedAt
payload_too_large a save key exceeds the limit; details.limit
quota_exceeded more than 32 keys or 1 MB; details.limit
not_found no leaderboard with this key
score_rejected the score was rejected by the board rules; details.reason
not_supported the platform lacks this feature (isSupported)
gesture_required SDK 1.4: player.login() was not called from a player action handler (click, tap, key) (player)
— (ads) normal ad outcomes are not errors: ads.* answer { shown/rewarded/available: false, reason }; no network or session — reason: 'unavailable' (ads)
invalid_payload invalid arguments; for saves also a string with \u0000 or a lone surrogate
message_too_large, unsupported_version, internal_error a call or protocol error

What the SDK retries by itself. A save rejected with a data error (invalid_payload, payload_too_large, quota_exceeded, message_too_large) is not retried: the data is dropped from the buffer. On any other error, including internal_error and unknown codes, the data stays in the buffer and is retried (1 → 60 s, at most 20 times per page load; also on online, hiding the tab, flush, the next init). In both cases the set promise rejects with the error code.

Limits

What Limit
Saves a key ≤ 512 KB, ≤ 32 keys and ≤ 1 MB per game; 60 writes and 4 MB per minute per tab (budget)
Lifecycle 120 notifications per minute (ready, gameplay.*, happyMoment); repeating gameplay.start/gameplay.stop of the same state does not count
Player token 10 requests per minute per frame; the SDK serves the token from its cache until the end of its lifetime minus a minute
Sign-in from the game player.login() — 3 calls per minute per frame; a repeated call while the window is open does not count and gets the same promise; the window closes after 15 minutes (cancelled)
Ads 20 ads.* calls per minute per frame; the impression rate (cooldowns, caps per run and per day) is kept by the portal — going over is not an error but reason: 'cooldown' / 'cap_reached' (ads)
Leaderboards 60 submits per minute and not more often than the board's minIntervalMs
Analytics ≤ 300 events per minute; the rest is dropped. A batch not accepted because of the network, a timeout, a limit or unavailability goes back to the buffer (the last 200 events) and is retried (1 → 60 s)
Message saves.set ≤ 600 KB, an event batch ≤ 64 KB, others ≤ 8 KB