Class: ExponentialReconnectionPolicy

policies/reconnection~ExponentialReconnectionPolicy(baseDelay, maxDelay, startWithNoDelay)

new ExponentialReconnectionPolicy(baseDelay, maxDelay, startWithNoDelay)

A reconnection policy that waits exponentially longer between each reconnection attempt (but keeps a constant delay once a maximum delay is reached).

A random amount of jitter (+/- 15%) will be added to the pure exponential delay value to avoid situations where many clients are in the reconnection process at exactly the same time. The jitter will never cause the delay to be less than the base delay, or more than the max delay.

Parameters:
Name Type Description
baseDelay Number

The base delay in milliseconds to use for the schedules created by this policy.

maxDelay Number

The maximum delay in milliseconds to wait between two reconnection attempt.

startWithNoDelay Boolean

Determines if the first attempt should be zero delay

Source:

Methods

_addJitter()

Adds a random portion of +-15% to the delay provided. Initially, its adds a random value of 15% to avoid reconnection before reaching the base delay. When the schedule reaches max delay, only subtracts a random portion of 15%.

Source:

getOptions()

Gets an associative array containing the policy options.

Source:

newSchedule() → {Object}

A new schedule that uses an exponentially growing delay between reconnection attempts.

Source:
Returns:

An infinite iterator.

Type
Object