Skip to main content
Version: v0.0.3

Function: createStarterClient()

createStarterClient(opts): Promise<MllpClient>

Three-line MLLP client with batteries-included defaults. The returned client is already CONNECTED, connect() has been awaited.

Defaults:

  • autoReconnect: true
  • ackTimeoutMs: 30_000
  • correlateByControlId: false (FIFO mode, simplest mental model)
  • pipeline: true
  • highWaterMark: 64
  • onBackpressure: 'reject'
  • handleSignals: false (opt-in)

The factory is async, so the literal three-line north-star snippet has an explicit await BEFORE createStarterClient(...), without it, the using declaration would receive a Promise, not an MllpClient, and Symbol.asyncDispose would not run at scope exit.

Parameters

opts

StarterClientOptions

Returns

Promise<MllpClient>

Example

import { createStarterClient } from '@cosyte/mllp';
await using c = await createStarterClient({ host: 'localhost', port: 2575 });
const ack = await c.send(payloadBuffer);