Expand description
Raw TCP client with optional TLS, suffix framing, heartbeats, and automatic reconnection.
§State management
The client tracks active, reconnecting, disconnecting, and closed states. State changes notify waiting tasks immediately instead of relying only on periodic checks.
§Connection ownership
A controller owns the connection lifecycle. A dedicated reader task passes complete messages to the configured callback, while a dedicated writer task serializes concurrent sends received over a channel.
§Framing and heartbeats
The configured suffix frames the byte stream in both directions. The writer appends it to sent messages and heartbeats, and the reader uses it to split incoming data into complete messages. Heartbeats are optional and run in a separate task.
§Reconnection
The writer buffers messages while reconnecting. A successful reconnect installs the replacement writer, drains that buffer, restarts the reader, and then invokes the configured post-reconnection callback.
Structs§
- Socket
Client - A suffix-framed TCP client with optional TLS and automatic reconnection.
- Socket
Client Builder - Use builder syntax to set the inputs and finish with
connect(). - Socket
Reconnect Handle - Cloneable controller handle for requesting one raw socket reconnect.
Type Aliases§
- Socket
Reconnect Replay - Produces protocol messages that must precede buffered application writes after reconnect.