Skip to content

Channel State

A subscribed channel can be one of the following two states: joined or left. A joined channel is active and all messaging listeners/callbacks received published messages. When a channel is in the left state, the subscription is put on hold and no messages arrive to the added listeners/callbacks. When a channel subscription is established, the initial state is joined. The following API provides access to control channel's state:

Leaving Channel

// subscribe to a channel
IChannel channel = Backendless.Messaging.Subscribe( "MyChannel" );

// leave the channel
channel.Leave();

Joining Channel

// subscribe to a channel
IChannel channel = Backendless.Messaging.Subscribe( "MyChannel" );

// leave the channel - skipped for brevity
//.....


// join the channel
channel.Join();

Checking Status

// subscribe to a channel
IChannel channel = Backendless.Messaging.Subscribe( "MyChannel" );

Boolean subscriptionStatus = channel.IsJoined();