Persistent outbound client; sessions and handler state are fresh on reconnect.
Summary
Functions
Builds a child spec, validating the endpoint options. See NodeWire.
Kills the current session and disables retries until reconnect/1 is called.
Kills any existing session and starts a fresh asynchronous connection attempt.
Sends through the current connection; returns :not_connected if unavailable.
Starts a linked persistent client using the endpoint options in NodeWire.
Returns the latest connection snapshot and failure reason.
Types
@type status() :: %{ state: :negotiated | :disconnected, connection: NodeWire.Conn.t() | nil, reason: atom() | NodeWire.Error.t() | nil }
Latest asynchronous connection state, snapshot and failure reason.
Functions
@spec child_spec(NodeWire.options()) :: Supervisor.child_spec()
Builds a child spec, validating the endpoint options. See NodeWire.
@spec disconnect(GenServer.server()) :: :ok
Kills the current session and disables retries until reconnect/1 is called.
This does not perform a graceful CLOSE exchange. Exits if the client is unavailable.
@spec reconnect(GenServer.server()) :: :ok
Kills any existing session and starts a fresh asynchronous connection attempt.
Re-enables attempts after disconnect/1 or a permanent failure. The configured
automatic reconnect policy still applies to later failures. Exits if unavailable.
@spec send(GenServer.server(), NodeWire.message(), NodeWire.send_options()) :: NodeWire.send_result()
Sends through the current connection; returns :not_connected if unavailable.
Accepts :timeout_ms (default 5,000) and :on_sent tracking tags, as in
NodeWire.Server.send/4. Messages are never automatically replayed after
reconnect. See NodeWire for local-write success and unknown outcomes.
Return send actions from handlers instead of synchronously sending to yourself.
@spec start_link(NodeWire.options()) :: GenServer.on_start()
Starts a linked persistent client using the endpoint options in NodeWire.
Connecting, authentication and readiness are asynchronous. Invalid
configuration raises; observe status/1 for subsequent connection failures.
Handler state is initialized afresh on every connection attempt.
@spec status(GenServer.server()) :: status()
Returns the latest connection snapshot and failure reason.
:negotiated does not imply application readiness; inspect the snapshot's
phase. :disconnected also covers attempts in progress. Successful attempts
clear earlier reasons. Exits if the client process is unavailable.