Leave channels
Requires App Context
Enable App Context for your keyset in the Admin Portal.
Remove a user's channel membership with leave().
Interactive demo
Sample React app demonstrating user-channel membership.
Want to implement something similar?
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
This method has the following signature:
1channel.leave(): Promise<true | error>
Input
This method doesn't take any parameters.
Output
| Type | Description |
|---|---|
Promise<true> or Promise<Error> | Promise returned for leaving the channel successfully, or an error. |
Sample code
Leave the support channel.
1// reference the "channel" object
2const channel = await chat.getChannel("support")
3// you must be a member of the "support" channel...
4await channel.join({ custom: { support_plan: "premium" } })
5// ...to leave it
6await channel.leave()