> 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. # updateToken * **updateToken**(`token`): `Promise` Replaces the token used by the client with a new one. You can use this method to replace the token when, for example, it is expiring, in order to keep the session alive. The new token can contain different channels from the previous one. In that case, you will need to subscribe to the new channels if you want to receive messages for those. Channels that were in the previous token but are not in the new one will get unsubscribed automatically. ## Parameters **`token`** `string` — required The new token. --- ## Returns `Promise` ## Example ```js const chatClient = new Chat.Client({ token: '' }) chatClient.on('session.expiring', async () => { const newToken = await fetchNewToken(..) await chatClient.updateToken(newToken) }) ```