struct MQTT::Reconnect

Overview

Controls how a client re-establishes a connection that dropped unexpectedly. Delays back off exponentially and are capped at #max_delay.

Defined in:

mqtt/reconnect.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(initial_delay : Time::Span = 1.second, max_delay : Time::Span = 30.seconds, max_attempts : Int32 | Nil = nil) #

[View source]

Instance Method Detail

def delay_for(attempt : Int32) : Time::Span #

attempt is 1 based


[View source]
def give_up?(attempt : Int32) : Bool #

[View source]
def initial_delay : Time::Span #

[View source]
def max_attempts : Int32 | Nil #

nil retries forever


[View source]
def max_delay : Time::Span #

[View source]