*** id: e991c6b7-5e7c-4c6f-a643-365f5bd2114c title: subscribe slug: /node/reference/chat/client/subscribe description: subscribe method for the Client class. max-toc-depth: 3 ---------------- [link-2]: /docs/server-sdk/v3/node/reference/chat/client/unsubscribe ### subscribe * **subscribe**(`channels`): `Promise` List of channels for which you want to receive messages. Note that the `subscribe` function is idempotent, and calling it again with a different set of channels *will not* unsubscribe you from the old ones. To unsubscribe, use [unsubscribe][link-2]. #### Parameters | Name | Type | Description | | :--------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | | `channels` | `string` \| `string[]` | The channels to subscribe to, either in the form of a string (for one channel) or an array of strings. | #### Returns `Promise` #### Example ```js const chatClient = new Chat.Client({ project: "", token: "", }); chatClient.on("message", (m) => console.log(m)); await chatClient.subscribe("my-channel"); await chatClient.subscribe(["chan-2", "chan-3"]); ```