Leave channels

Requires App Context

To set up and manage channel membership, you must enable App Context for your app's keyset in the Admin Portal.

Use the leave() method to remove user's channel membership and unsubscribe them from receiving messages and events.

Interactive demo

Check how a sample implementation could look like in a React app showcasing user-channel membership.

Want to implement something similar?

Read how to do that or go straight to the demo's source code.

Test it out

Choose whether you want to join or leave a given channel and wait until you get notified when that happens.

Method signature


Under the hood

This method has the following signature:

channel.leave(): Promise<true | error>


This method doesn't take any parameters.


Promise<true> or Promise<Error>Promise returned for leaving the channel successfully, or an error.

Basic usage

Leave the support channel.

// reference the "channel" object
const channel = await chat.getChannel("support")
// you must be a member of the "support" channel...
await channel.join(console.log)
// ...to leave it
await channel.leave()
Last updated on