API reference
Exports of @sigx/actors-tcp v0.5.0.
tcpTransport(options?)
Returns a HostTransportFactory for cluster({ transport }).
interface TcpTransportOptions {
port?: number;
host?: string;
advertiseHost?: string; // what peers dial — see Installation
maxFrameBytes?: number;
credit?: number;
keepAliveMs?: number; // 15000
handshakeTimeoutMs?: number; // 10000 — 0 disables
maxPendingInbound?: number; // 256 — 0 disables
}
handshakeTimeoutMs and maxPendingInbound bound what an unauthenticated peer can hold open:
a connection that never completes its handshake is dropped, and the number of in-flight
inbound connections awaiting one is capped.
This transport binds all interfaces unless host is set, and speaks no
TLS. It belongs on a private network. Set host to the interface you
mean, and do not expose the port.
Constants
| Export | Value |
|---|---|
TCP_TRANSPORT_NAME | 'tcp' — the key under HostDescriptor.addresses |
Re-exported frame codec
Shared with @sigx/actors-ws, and re-exported here for
transport authors:
DEFAULT_CREDIT, DEFAULT_MAX_FRAME_BYTES, encodeFrame, FrameType.
The same codec is available from @sigx/actors/cluster/frames.
Writing your own transport
transportConformance holds the cases a transport must pass and is the definition of correct
behaviour. It is currently contributor-facing only — reachable inside the actors workspace
as @sigx/actors/cluster/testing through a tsconfig and vitest alias, but not in the published
exports map.
The rule it enforces throughout: assert on the error kind, never on an HTTP status. That
is what makes the contract expressible off HTTP at all.
Next steps
- Overview — the measured case for it.
- Installation — options and
advertiseHost. - Host transports — the comparison and rollout.
