ZenWebsocket.Client.Reconnect (ZenWebsocket v0.8.0)

Copy Markdown View Source

Explicit reconnect target and option handling for ZenWebsocket.Client.

Summary

Functions

Builds the keyword list stored on the Client struct for a later reconnect.

Reads reconnect target and opts from a live Client struct or its GenServer.

Re-opens a connection via connect_fun or a caller-supplied :reconnector.

Functions

reconnect_opts_from_state(state)

@spec reconnect_opts_from_state(map()) :: keyword()

Builds the keyword list stored on the Client struct for a later reconnect.

reconnect_target(client)

@spec reconnect_target(map()) ::
  {ZenWebsocket.Config.t() | String.t() | nil, keyword()}

Reads reconnect target and opts from a live Client struct or its GenServer.

reconnect_with(target, opts, connect_fun)

@spec reconnect_with(
  ZenWebsocket.Config.t() | String.t() | nil,
  keyword(),
  (term(), keyword() -> {:ok, struct()} | {:error, term()})
) :: {:ok, struct()} | {:error, term()}

Re-opens a connection via connect_fun or a caller-supplied :reconnector.