Skip to main content

init_reconnecting_socket

Function init_reconnecting_socket 

Source
pub fn init_reconnecting_socket<FnConnect, Backoff, Socket, ErrConnect>(
    connect: FnConnect,
    timeout_connect: Duration,
    backoff: Backoff,
) -> impl Stream<Item = Result<Socket, ConnectError<ErrConnect>>>
where FnConnect: AsyncFnMut() -> Result<Socket, ErrConnect>, Backoff: ReconnectBackoff,
Expand description

Initialises a “reconnecting socket” using the provided connect function.

Upon disconnecting, the ReconnectBackoff is used to determine how long to wait between reconnecting attempts.

Returns a Stream of Socket connection results.