Actors/Packages/TCP/API reference
@sigx/actors-tcp · Preview

API reference#

Exports of @sigx/actors-tcp v0.1.0.

tcpTransport(options?)#

Returns a HostTransportFactory for cluster({ transport }).

TypeScript
interface TcpTransportOptions {
    port?: number;
    host?: string;
    advertiseHost?: string;   // what peers dial — see Installation
    maxFrameBytes?: number;
    credit?: number;
    keepAliveMs?: number;     // 15000
}

Constants#

ExportValue
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#