Skip to content

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:

Channel channel = await Backendless.messaging.subscribe("that");

Function(String) callback = (chatMessage) => print("got a message: $chatMessage");

channel.addMessageListener(callback);