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 "default" channel
public Channel Backendless.Messaging.subscribe();

// subscribe to the specific channel
public Channel Backendless.Messaging.subscribe( String channelName );

where:

Argument                Description
channelName name of the channel to subscribe to.

Return value:

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