Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FixedDelayStrategy

FixedDelayStrategy is a reconnect delay strategy implementation that waits a fixed amount of time before retrying a connection.

Create the fixed strategy with all default values:

const strategy = new FixedDelayStrategy();

Set the maximum retry time to 15 seconds, leave the default delay value:

const strategy = new FixedDelayStrategy({maximumRetryTime: 15000});

Set all params as arguments...

const strategy = new FixedDelayStrategy(2000, 45000);

... or using the object with values:

const strategy = new FixedDelayStrategy({delay: 2000, maximumRetryTime: 45000});

Hierarchy

  • FixedDelayStrategy

Implements

Index

Constructors

constructor


  • Parameters

    • Optional delay: number

      The time (in milliseconds) to wait before reconnecting to a server after a failed connection. The default value is 200 ms.

    • Optional maximumRetryTime: number

      The maximum time (milliseconds) to allow reconnect attempts to continue without a successful connection, before giving up and abandoning the connection attempt. If zero, the client never gives up. The default value is 0.

    Returns FixedDelayStrategy


  • Parameters

    Returns FixedDelayStrategy

Methods

getConnectWaitDuration

  • getConnectWaitDuration(uri: string): number
  • This method returns the time (in milliseconds) that the client should delay before connecting to the given server URI.

    Parameters

    • uri: string

      The URI of the server.

    Returns number

    The time (in milliseconds) that the client should delay.

reset

  • reset(): void
  • This method resets the state of this reconnect delay. AMPS calls this method when a connection is established.

    Returns void