# IMQClient.subscribe() method · @imqueue/rpc

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

Subscribes to the service's event channel, named after [IMQClient.serviceName](https://imqueue.org/api/rpc/latest/rpc.imqclient.servicename/) — the same channel a service's `publish()` writes to, so every client of that service receives every published payload.

**Signature:**

```typescript
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()](https://imqueue.org/api/rpc/latest/rpc.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.

