Skip to content


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 = [Backendless.shared.messaging subscribeWithChannelName:@"chat"];
RTSubscription *subscription = [channel addStringMessageListenerWithResponseHandler:^(NSString *chatMessage) {
    NSLog(@"Got a message: %@", chatMessage);
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
let channel = Backendless.shared.messaging.subscribe(channelName: "chat")
let _ = channel.addStringMessageListener(responseHandler: { chatMessage in
    print("Got a message: \(chatMessage)")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")