unsubscribe( )
Unsubscribes from a channel or channel resource.
The unsubscribe()
function unsubscribes from receiving messages published
on the specified channel or channel resource.
-
Use the
channel
property of theUnsubscribeOptions
object passed to theoptions
parameter to unsubscribe from all subscriptions to a specific channel or channel resource.When you unsubscribe from a channel you do not unsubscribe from the resources on that same channel. To no longer receive messages on a channel resource, you must explicitly unsubscribe from the specific resource.
-
Use the
subscriptionId
property of theUnsubscribeOptions
object passed to theoptions
parameter to unsubscribe from a specific subscription.This option is typically used when you have more than one subscription to the same channel or channel resource and you only want to unsubscribe from one of those subscriptions.
Get a subscription's
subscriptionId
from the resolution of the Promise returned when creating the subscription with thesubscribe()
function.
Options to use when unsubscribing.