kicksdk (JavaScript)
    Preparing search index...

    Class Backoff

    Reconnect delays: 1 s doubling to 30 s, and a slower stage for terminal closes (nextDelayFor).

    Index
    • From initialMs, doubling to maxMs (whole milliseconds).

      Parameters

      • Optionalinitial_ms: number | null
      • Optionalmax_ms: number | null

      Returns Backoff

    • Returns void

    • Returns void

    • The next wait, ms.

      Returns number

    • The wait before reconnecting after a connection ended, ms. retryAfterMs is what the end asked for: a close action's retry_after_ms, retryAfterMs(code) for a socket's close code, or 0 for a failure without a code. With 0, exactly nextDelayJittered. With more (a terminal close), at least that, doubling with each terminal close since reset() up to six times it (300000: 5, 10, 20, then 30 minutes), plus up to a quarter more by random. Reconnect with a new client id after a terminal close.

      Parameters

      • retry_after_ms: number
      • random: number

      Returns number

    • The next wait, ms, spread over [half of it, all of it] by random, drawn uniformly from [0, 1) (Math.random()), so that clients dropped together do not all come back together. Out of range is clamped, NaN taken as 0.

      Parameters

      • random: number

      Returns number

    • The chat feed subscribed: back to the first wait, and the terminal streak ends.

      Returns void