*** id: e40f38c6-1f8d-4f08-acea-2a553db78fbc title: subscribe slug: /js/reference/chat/client/subscribe max-toc-depth: 3 ---------------- * **subscribe**(`channels`): `Promise` List of channels for which you want to receive messages. You can only subscribe to those channels for which your token has read permission. 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](/docs/browser-sdk/v3/js/reference/chat/client/unsubscribe). ## Parameters 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({ token: "", }); chatClient.on("message", (m) => console.log(m)); await chatClient.subscribe("my-channel"); await chatClient.subscribe(["chan-2", "chan-3"]); ```