IMQClient.(constructor)

Constructs a client.

Signature:

constructor(options?: Partial<IMQClientOptions>, serviceName?: string, name?: string);

Parameters

Parameter

Type

Description

options

Partial<IMQClientOptions>

(Optional) client options, merged over DEFAULT_IMQ_CLIENT_OPTIONS

serviceName

string

(Optional) the queue calls are addressed to. Defaults to this client's own name with a trailing Client removed.

name

string

(Optional) this client's base name. Defaults to the constructor's name, so pass it explicitly if your build renames classes — a minifier would otherwise silently retarget the RPC.

Exceptions

TypeError when IMQClient is constructed directly rather than through a subclass

Remarks

Construction has side effects. It reserves an instance id by creating a pid file under $TMPDIR/.imq-rpc, opens its message queue (two in singleQueue mode), raises the process max-listener limit once per process, and installs SIGTERM/SIGINT/SIGHUP/SIGQUIT handlers that destroy the client and then exit the process after IMQ_SHUTDOWN_TIMEOUT. Any library embedding a client inherits that process-terminating behaviour.

Only IMQClient.destroy() releases the pid file and removes those handlers.

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