MLLP.Client.start_link
start_link
, go back to MLLP.Client module for more information.
start_link(address, port, options \\ [])
Specs
start_link( address :: ip_address(), port :: :inet.port_number(), options :: MLLP.ClientContract.options() ) :: {:ok, pid()}
Starts a new MLLP.Client.
MLLP.Client.start_link/4 will start a new MLLP.Client process.
This function will raise a ArgumentError
if an invalid ip_address()
is provided.
Options
:use_backoff
- Specify if an exponential backoff should be used for connection. When an attempt to establish a connection fails, either post-init or at some point during the life span of the client, the backoff value will determine how often to retry a reconnection. Starts at 1 second and increases exponentially until reachingbackoff_max_seconds
seconds. Defaults totrue
.:backoff_max_seconds
- Specify the max limit of seconds the backoff reconection attempt should take, defauls to 180 (3 mins).:auto_reconnect_interval
- Specify the interval between connection attempts. Specifically, if an attempt to establish a connection fails, either post-init or at some point during the life span of the client, the value of this option shall determine how often to retry a reconnection. Defaults to 1000 milliseconds. This option will only be used ifuse_backoff
is set tofalse
.:reply_timeout
- Optionally specify a timeout value for receiving a response. Must be a positive integer or:infinity
. Defaults to 60 seconds.:socket_opts
- A list of socket options as supported by:gen_tcp
. Note that:binary
,:packet
, and:active
can not be overridden. Default options are enumerated below.- send_timeout: Defaults to 60 seconds
- send_timeout_close: Defaults to true
:close_on_recv_error
- A boolean value which dictates whether the client socket will be closed when an error in receiving a reply is encountered, this includes timeouts. Setting this totrue
is usually the safest behaviour to avoid a "dead lock" situation between a client and a server. This functions similarly to the:send_timeout
option provided by:gen_tcp
. Defaults totrue
.:reconnect_on_send_error
- A boolean value which dictates whether the client socket will be closed when an error is returned by the transport when attempting to send data. This generally useful in most MLLP.Client scenarios as the the MLLP protocol provides no recourse mechanism when a connection error occurs and it is non-trival to distiguish from application level and socket level errors. Setting this totrue
is usually the safest behaviour, as such it defaults totrue
.:tls
- A list of tls options as supported by:ssl
. When using TLS it is highly recommended you set:verify
to:verify_peer
, select a CA trust store using the:cacertfile
or:cacerts
options. Additionally, further hardening can be achieved through other ssl options such as enabling certificate revocation via the:crl_check
and:crl_cache
options and customization of enabled protocols and cipher suites for your specific use-case. See:ssl
for details.