pub trait ReconnectionPolicy: Send + Sync {
// Required method
fn should_retry(&self, attempts: usize) -> ControlFlow<(), Duration>;
}
Expand description
a simple Reconnection Handler.
with implementing this trait and passing it to the InitParams
inside the Client
you can have your own
custom implementations for handling connection failures.
the default implementation is NoReconnect which does not handle anything! there is also a FixedReconnect
which sets a fixed attempt count and a duration
note that this will return a ControlFlow<(), Duration>
which tells the handler either Break
the Connection Attempt or
Continue
After the Given Duration
Required Methods§
sourcefn should_retry(&self, attempts: usize) -> ControlFlow<(), Duration>
fn should_retry(&self, attempts: usize) -> ControlFlow<(), Duration>
this function will indicate that the handler should attempt for a new reconnection or not.
it accepts a attempts
which is the amount of reconnection tries that has been made already