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.
Method signature
This method has the following signature:
channel.leave(): PNFuture<Unit>
Input
This method doesn't take any parameters.
Output
Type | Description |
---|---|
PNFuture<Unit> | Function that returns an instance of PNFuture that will be completed with Unit when the leave operation is completed. |
Basic usage
Leave the support
channel.
val channel: Channel
// ...
// you must be a member of the "support" channel...
channel.join().async {
// ...
}
// ...to leave it sometime later
channel.leave().async {
// ...
}