Subscribes to a channel or resource.
The method attempts to establish a subscription to the specified channel or resource. It returns the subscription ID immediately while the subscription is attempted in the background.
Use the options parameter to register handlers that run whenever the subscription succeeds or generates an error. For some errors, the subscription is re-attempted automatically. The onSubscribed() handler runs on every successful re-subscription.
Learn more about the subscription lifecycle.
Channel and resource to subscribe to.
messageHandler(message: Message, channel: SubscribeChannel): void Handler that runs whenever a message is published to the channel or resource.
Lifecycle handlers for subscription events.
This method doesn't return any custom errors, but may return standard errors. Learn more about standard Wix errors.