ZenWebsocket.Client.Retry (ZenWebsocket v0.8.0)

Copy Markdown View Source

Connection-error retry state machine for ZenWebsocket.Client.

Attempt-identity timers live in ZenWebsocket.Client.Connection; this module applies retry policy to reconnect immediately, schedule backoff, or stop.

Summary

Functions

Handles a failed open by cleaning up and maybe scheduling a retry.

Cleans up a failed connection and retries or stops according to policy.

Times out the in-flight connection attempt when the attempt identity matches.

Handles a scheduled reconnect tick, stopping when retries are exhausted.

Functions

continue_failed(state, reason)

@spec continue_failed(map(), term()) :: {:noreply, map()} | {:stop, term(), map()}

Handles a failed open by cleaning up and maybe scheduling a retry.

handle_connection_error(state, reason)

@spec handle_connection_error(map(), term()) ::
  {:noreply, map()} | {:stop, term(), map()}

Cleans up a failed connection and retries or stops according to policy.

handle_connection_timeout(state)

@spec handle_connection_timeout(map()) :: {:noreply, map()} | {:stop, term(), map()}

Times out the in-flight connection attempt when the attempt identity matches.

handle_retry_reconnect(state)

@spec handle_retry_reconnect(map()) ::
  {:noreply, map()}
  | {:noreply, map(), {:continue, :reconnect}}
  | {:stop, term(), map()}

Handles a scheduled reconnect tick, stopping when retries are exhausted.