> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # subscribe > subscribe method for the PubSub.Client class. ### subscribe * **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/pubsub/client/unsubscribe). #### Parameters **`channels`** `string | string[]` — required 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 pubSub = new PubSub.Client({ token: "" }); pubSub.on("message", (m) => console.log(m)); await pubSub.subscribe("my-channel"); await pubSub.subscribe(["chan-2", "chan-3"]); ``` > subscribe method for the PubSub.Client class.