Introduction¶
In order to receive published messages, application must subscribe to a channel. The subscription API returns a Channel
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:
var channel = Backendless.Messaging.subscribe( "chat" );
function onMessage( message ) {
console.log( "Message received: " + message )
}
channel.addMessageListener( onMessage );