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
var strategy = new amps.FixedDelayStrategy();

// set the maximum retry time to 15 seconds, leave the default delay value
var strategy = new amps.FixedDelayStrategy({maximumRetryTime: 15000});

// set all params as arguments...
var strategy = new amps.FixedDelayStrategy(2000, 45000);

// ... or using the object with values
var strategy = new amps.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