Skip to content

Introduction

In order to receive published messages, application must subscribe to a channel. The subscription API returns a IChannel object which can  be used to add messaging callbacks. A callback is used by Backendless to deliver published messages to the client application.

Consider the following example, which demonstrates subscribing to a channel and adding a messaging callback:

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

// declare a listener
MessageReceived<string> messageListener = ( message ) =>
{
  Console.WriteLine( $"received message - {message}");
};

// add the listener to the channel
channel.AddMessageListener( messageListener );