Skip to content
1 min read · 140 words

Function: serveIsolatedOverPort()

ts
function serveIsolatedOverPort<S>(
  spec: S,
  factory: IsolatedImplementationFactory<S>,
  port: PortLike,
  options?: ServeIsolatedOptions,
): {
  stop: () => void;
};

Defined in: src/batteries/isolation/serve.ts:90

Serve spec over an already-constructed PortLike — the environment-neutral primitive. Builds the implementation via factory, wires a GuestEndpoint to it, and announces readiness (ready envelope) once the encoder-availability probe resolves.

Type Parameters

Type Parameter
S extends IsolatedServiceSpec<MethodMap, StreamMap, EventMap>

Parameters

ParameterType
specS
factoryIsolatedImplementationFactory<S>
portPortLike
options?ServeIsolatedOptions

Returns

ts
{
  stop: () => void;
}

A stop() function that tears down the endpoint's port subscription. Does NOT itself close the port — callers own the port's lifecycle.

NameTypeDefined in
stop()() => voidsrc/batteries/isolation/serve.ts:95

Throws

@nhtio/adk/batteries/isolation!E_INVALID_ISOLATION_OPTIONS when options fails validation.