Skip to content

Basic Publish

The following example publishes a message to the default channel:

NSString *message = @"Hello World!";
[Backendless.shared.messaging publishWithChannelName:@"default" message:message responseHandler:^(MessageStatus *messageStatus) {
    NSLog(@"Message (id = %@) has been published with status: %@", messageStatus.messageId, messageStatus.status);
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
}];
let message = "Hello World!"
Backendless.shared.messaging.publish(channelName: "default", message: message, responseHandler: { messageStatus in
    print("Message (id = \(messageStatus.messageId ?? "") has been published with status: \(messageStatus.status ?? "")")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")
})