Skip to main content
Version: v0.0.3

Interface: ClientStats

Observability snapshot returned by MllpClient.getStats.

All fields are JSON-serializable, no Buffers, no class instances, no Maps, no circular references. lastConnectedAt and lastAckAt are epoch milliseconds (numbers), NOT Date instances, log-pipeline friendly.

warningsByCode keys are constrained to the public WarningCode union, adding/removing a code is a breaking change (CLAUDE.md stable-codes guardrail enforced at the type boundary).

Example

const stats = client.getStats();
logger.info(JSON.stringify(stats));
// {"state":"CONNECTED","connectionId":"…","queueDepth":0, … }

Properties

ackedTotal

readonly ackedTotal: number

Total ACKs matched + resolved since construction.


connectionId

readonly connectionId: string | null

Live Connection's id, or null before the first connect (or post-CLOSED).


inFlight

readonly inFlight: number

Entries with sentAt !== null, actually written to the wire / awaiting ACK.


lastAckAt

readonly lastAckAt: number | null

Epoch ms of the most recent successful ACK. null until first ACK.


lastConnectedAt

readonly lastConnectedAt: number | null

Epoch ms of the last CONNECTED transition. null until first connect.


queueBytes

readonly queueBytes: number

Sum of frame.length across live correlator entries.


queueDepth

readonly queueDepth: number

Total live correlator entries (in-flight + pre-flush + serialization-queued).


reconnectAttempts

readonly reconnectAttempts: number

Total reconnect attempts since construction.


sentTotal

readonly sentTotal: number

Total successful connection.send() calls since construction.


state

readonly state: ConnectionState

Current FSM state, mirrors client.state.


timedOutTotal

readonly timedOutTotal: number

Total ACK timeouts since construction.


tls

readonly tls: boolean

Whether this client is configured for TLS. Mirrors ClientOptions.tls being set.


totalBytesIn

readonly totalBytesIn: number

Bytes received from the peer (current Connection).


totalBytesOut

readonly totalBytesOut: number

Bytes written to the peer (current Connection).


warningsByCode

readonly warningsByCode: Partial<Record<WarningCode, number>>

Aggregated warning counts. Keys are constrained to the public WarningCode union. Connection-level warnings + Correlator MLLP_ACK_* warnings are merged.