IMQClient.subscribe() method

Subscribes to the service's event channel, named after IMQClient.serviceName — the same channel a service's publish() writes to, so every client of that service receives every published payload.

Signature:

subscribe(handler: (data: JsonObject) => any): Promise<void>;

Parameters

Parameter

Type

Description

handler

(data: JsonObject) => any

invoked with the parsed JSON payload of each published message

Returns:

Promise<void>

Remarks

This is fan-out, not a private channel. Subscribing uses a dedicated connection and does not require IMQClient.start(). Calling it more than once registers additional handlers rather than replacing the existing one, and the subscription is re-established automatically on reconnect.

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.