# IMQClient.(constructor) · @imqueue/rpc

Source: https://imqueue.org/api/rpc/latest/rpc.imqclient._constructor_/
Published: 2026-08-04
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/rpc 3.5.3 — generated reference, not hand-written

Constructs a client.

**Signature:**

```typescript
constructor(options?: Partial<IMQClientOptions>, serviceName?: string, name?: string);
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| options | Partial<[IMQClientOptions](https://imqueue.org/api/rpc/latest/rpc.imqclientoptions/)> | _(Optional)_ client options, merged over [DEFAULT\_IMQ\_CLIENT\_OPTIONS](https://imqueue.org/api/rpc/latest/rpc.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](https://imqueue.org/api/rpc/latest/rpc.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()](https://imqueue.org/api/rpc/latest/rpc.imqclient.destroy/) releases the pid file and removes those handlers.

