Skip to content

Documentation / @super-line/adapter-zeromq / createZeroMqAdapter

Function: createZeroMqAdapter()

Call Signature

createZeroMqAdapter(options): Promise<ZeroMqAdapter>

Defined in: index.ts:159

Create a ZeroMQ Adapter for multi-node fan-out. Three shapes:

  • mesh (default): brokerless full mesh — this node binds a PUB and connects a SUB to every peer. Returns the resolved bind endpoint.
  • proxy: connect through a central createZeroMqProxy forwarder.
  • BYO: hand in your own pre-wired { pub, sub } sockets (the adapter does not own their lifecycle — close() leaves them open).

ZeroMQ's lazy connect + auto-reconnect mean peers may start in any order. At-most-once delivery, matching the library's model.

Parameters

options

ZeroMqMeshOptions

Returns

Promise<ZeroMqAdapter>

Example

ts
const adapter = await createZeroMqAdapter({ bind: 'tcp://0.0.0.0:5555', peers: ['tcp://node-b:5555'] })
createSuperLineServer(api, { server, adapter })

Call Signature

createZeroMqAdapter(options): Promise<Adapter>

Defined in: index.ts:160

Create a ZeroMQ Adapter for multi-node fan-out. Three shapes:

  • mesh (default): brokerless full mesh — this node binds a PUB and connects a SUB to every peer. Returns the resolved bind endpoint.
  • proxy: connect through a central createZeroMqProxy forwarder.
  • BYO: hand in your own pre-wired { pub, sub } sockets (the adapter does not own their lifecycle — close() leaves them open).

ZeroMQ's lazy connect + auto-reconnect mean peers may start in any order. At-most-once delivery, matching the library's model.

Parameters

options

ZeroMqProxyModeOptions | ZeroMqByoOptions

Returns

Promise<Adapter>

Example

ts
const adapter = await createZeroMqAdapter({ bind: 'tcp://0.0.0.0:5555', peers: ['tcp://node-b:5555'] })
createSuperLineServer(api, { server, adapter })

Released under the MIT License.