Skip to main content
Version: v0.0.3

Interface: ServerStats

Observability snapshot returned by server.getStats().

All fields are JSON-serializable. connections and activeConnections both reflect the current live connection count.

Example

const stats = server.getStats();
console.log(JSON.stringify(stats)); // log-pipeline friendly

Properties

acceptedTotal

readonly acceptedTotal: number

Total connections accepted since listen() (monotonically increasing).


activeConnections

readonly activeConnections: number

Current live connection count. Same value as connections.


closedTotal

readonly closedTotal: number

Total connections closed since listen() (monotonically increasing).


connections

readonly connections: number

Current live connection count. Same value as activeConnections.


host

readonly host: string | null

Bound host, or null before listen().


listening

readonly listening: boolean

Whether the server is currently accepting connections.


port

readonly port: number | null

Bound port, or null before listen().


tls

readonly tls: boolean

Whether this server is configured for TLS. Mirrors ServerOptions.tls being set.


tlsClientErrorsTotal

readonly tlsClientErrorsTotal: number

Total 'tlsClientError' events (failed TLS handshakes, incl. rejected client certs) since listen().


totalBytesIn

readonly totalBytesIn: number

Aggregate bytes received across all current connections.


totalBytesOut

readonly totalBytesOut: number

Aggregate bytes sent across all current connections.