TcpTransport
Defined in: src/cluster/Transport.ts:61
TCP-backed cluster transport. Wire framing lives in Protocol.ts; the
actual socket API is plugged in per runtime via TcpBackend
(src/runtime/tcp/), so this class is identical on Bun, Node.js, and
Deno — the differences in listen/connect/socket shape are absorbed by
the adapter.
Per-connection state is tracked in a WeakMap<TcpSocketLike, Conn> —
TcpSocketLike is intentionally opaque and has no stash slot.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TcpTransport(
self,log,tls?,maxFrameBytes?):TcpTransport
Defined in: src/cluster/Transport.ts:69
Parameters
Section titled “Parameters”TlsTransportSettings | null
Optional TLS configuration — when set, both listener and dialer use TLS.
maxFrameBytes?
Section titled “maxFrameBytes?”number = DEFAULT_MAX_FRAME_BYTES
Per-frame size cap (security). Frames whose length-prefix exceeds this are rejected before any payload bytes are buffered — closes the 4-GiB-claim DoS vector documented on FrameDecoder. Default: DEFAULT_MAX_FRAME_BYTES (16 MiB). Raise it only if you genuinely send larger envelopes; the cap is per-frame, not aggregate.
Returns
Section titled “Returns”TcpTransport
Properties
Section titled “Properties”
readonlyself:NodeAddress
Defined in: src/cluster/Transport.ts:70
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”disconnect()
Section titled “disconnect()”disconnect(
peer):void
Defined in: src/cluster/Transport.ts:125
Close the connection to a peer.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”peers()
Section titled “peers()”peers():
NodeAddress[]
Defined in: src/cluster/Transport.ts:132
Peers currently connected (either inbound or outbound).
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”send()
Section titled “send()”send(
to,msg):void
Defined in: src/cluster/Transport.ts:115
Best-effort fire-and-forget send. Opens a connection on first use.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”setHandler()
Section titled “setHandler()”setHandler(
handler):void
Defined in: src/cluster/Transport.ts:85
Parameters
Section titled “Parameters”handler
Section titled “handler”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”shutdown()
Section titled “shutdown()”shutdown():
Promise<void>
Defined in: src/cluster/Transport.ts:103
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”start()
Section titled “start()”start():
Promise<void>
Defined in: src/cluster/Transport.ts:87
Returns
Section titled “Returns”Promise<void>