Skip to content

Channel Subscription

This API subscribes to a channel. Once the channel object is obtained, it can be used to add message listeners/callbacks. Subscription process is not instantaneous, which means an added listener may not receive messages published at the same time when it is added. In order to make sure that the subscriber is ready to receive messages from the channel, it is recommended to check the subscription status.

// subscribe to the channel. If channel name is not specified, subscribe to the "default" channel
Future<Channel> Backendless.messaging.subscribe([String channelName = DEFAULT_CHANNEL_NAME]);

where:

Argument                Description
channelName name of the channel to subscribe to.

Return value:

An instance of Channel object representing the channel subscription.  The channel object is used to add messaging listeners/callbacks.