Publish Push Notifications

Top  Previous  Next

Backendless supports push notification delivery to iOS, Android and Windows Phone devices. A device must be registered (see the Device Registration API) in order to receive a push notification. A push notification can be published via API or using the Backendless Console. The content of a push notification consists of a message body and the specialized message headers.

 

Publish a Push Notification from Console

To publish a push notification from Backendless console, navigate to the Messaging screen and click the Devices tab. Make sure there are registered devices, otherwise a push notification has nowhere to go.

Select the check boxes for the device(s) you would like to send a notification to.
Make sure to enter the message headers. The format of the headers must be: "header1-name":"header1-value", "header2-name":"header2-value". For example:

"android-ticker-text":"ticker text", "android-content-title":"content title", "android-content-text":"content text"

To send a push notification to specific devices, select the devices from the list and click the Selected devices checkbox.
To send a push notification to devices with a particular operating system, select the corresponding checkboxes.
Click the Publish button.
backendless-publishing-push-notification-console.zoom50

 

Publish Push Notification with API

Message publishing API supports the following scenarios:

 

Basic push notification - In the simplest form a push notification is sent to a channel and this to all the devices registered with the channel. The notification message must contain appropriate headers which control the appearance of the notification on the devices. Example.
 
Push notification delivered to devices grouped by the OS - With this type of message delivery push notifications can be sent to all devices of a specific operating system (or a group of).  This includes delivery to Android, iOS or Windows Phone devices or a any combination of. Example.
 
Push notification delivered to specific devices - This delivery type allows push notification delivery to individual devices. Example.
 
Delayed publishing - For all scenarios described above a push notification request can be configured to be executed at a later time (thus "delayed publishing"). Messages published with this delivery option can be canceled at any time using the message cancellation API. Example.

 

Push Notification Headers

The headers described below must be added to the "publish options" object or in case of REST clients, they are plain message headers:

Operating System

Headers

Description

iOS

"ios-alert":value

Sets the text of the alert message. If the header is not present and the published notification targets the iOS devices, Backendless sets the header to the value of the "message" argument. To disable this behavior, set the ios-alert header to null.

"ios-badge":value

Sets the value to update the badge with

"ios-sound":URL string or array of bytes

Sets either a URL for the sound notification to play on the device or an array of bytes for the sound to play.

Android

"android-ticker-text":value

Sets the text of the ticker showing up at the top of a device's screen when the device receives the notification.

"android-content-title":value

Sets the title of the notification as it is visible in the Android Notification Center

"android-content-text":value

Sets the message of the notification which appears under android-content-title in the Android Notification Center.

Windows Phone

"wp-title":value,
"wp-content":value

Sets the title and the content of a toast notification.

"wp-type":"TILE":
"wp-title" : value,
"wp-backgroundImage" : URL string,
"wp-badge" : number value,
"wp-backTitle" : value,
"wp-backImage" : URL string,
"wp-backContent" : value

Sets the properties for a tile notification.

"wp-type":"RAW",
"wp-raw":XMLString

Sets the properties for a raw notification

Method Signatures

Publishes a push notification to the specified channel. Headers must be added to the publishOptions argument.

// These methods publish a message to the specified channel with publish options.
// Use these methods to send additional message headers (including specialized
// headers for push notifications), publisher ID and channel's subtopic.
// The only difference between the methods is sync vs. async and how
// they deliver return value or faults.

// SYNCHRONOUS (BLOCKING) APIS
// ==================================================
// If the server returns an error, it is thrown as an exception
-(MessageStatus *)publish:(NSString *)channelName 
                           message:(id)message 
                           publishOptions:(PublishOptions *)publishOptions;
                           
// If the server returns an error, it is delivered through the "fault" object           
-(MessageStatus *)publish:(NSString *)channelName 
                           message:(id)message 
                           publishOptions:(PublishOptions *)publishOptions 
                           error:(Fault **)fault;
                           
// ASYNCHRONOUS (NON-BLOCKING) APIS
// ==================================================
// Server's return value and errors are delivered through the responder object
-(void)publish:(NSString *)channelName 
                message:(id)message 
                publishOptions:(PublishOptions *)publishOptions 
                responder:(id <IResponder>)responder;

// Server's return value and errors are delivered through the block-based callbacks
-(void)publish:(NSString *)channelName 
                message:(id)message 
                publishOptions:(PublishOptions *)publishOptions 
                response:(void(^)(MessageStatus *))responseBlock 
                error:(void(^)(Fault *))errorBlock;
// These methods publish a message to the specified channel with publish options.
// Use these methods to send additional message headers (including specialized
// headers for push notifications), publisher ID and channel's subtopic.
// The only difference between the methods is sync vs. async and how
// they deliver return value or faults.

// SYNCHRONOUS (BLOCKING) APIS
// ==================================================
// If the server returns an error, it is thrown as an exception
func publish(_ channelName: String!, 
             message message: AniObject!, 
             publishOptions publishOptions: PublishOptions) -> MessageStatus
                           
// If the server returns an error, it is delivered through the "fault" object           
func publish(_ channelName: String!, 
             message message: AniObject!, 
             publishOptions publishOptions: PublishOptions, 
             error fault: AutoreleasingUnsafeMutablePointer<Fault?>) -> MessageStatus
             
// ASYNCHRONOUS (NON-BLOCKING) APIS
// ==================================================
// Server's return value and errors are delivered through the responder object
func publish(_ channelName: String!, 
             message message: AniObject!, 
             publishOptions publishOptions: PublishOptions, 
             responder responder: IResponder!) -> Void

// Server's return value and errors are delivered through the block-based callbacks
func publish(_ channelName: String!, 
             message message: AniObject!, 
             publishOptions publishOptions: PublishOptions, 
             response responseBlock: ((DeviceRegistration!) -> Void)!, 
             error errorBlock: ((Fault!) -> Void)!) -> Void

Publishes a push notification to the specified channel with publish and delivery options. Headers must be added to the publishOptions argument.Delivery options can be used to:

1.Designate the message as "push notification only" or both a push notification and a pub/sub message.
2.Singlecast publishing - set a list of devices which should be receiving the notification.
3.Broadcast publishing - identify operating systems of the registered devices which should be receiving the notification.
4.Publish the message at a later time (delayed publishing).
5.Specify that the message should be republished multiple times (repeated publishing).

// These methods publish a message to the specified channel with publish options 
// and delivery options. Use these methods to send additional message headers 
// (including specialized headers for push notifications), publisher ID 
// and channel's subtopic. Additionally, configure delivery options to chose
// between singlecast (targetted delivery to specific devices) and broadcast
// (delivered to all devices of designates OS's), delayed publishing or
// repeated publishing.
// The only difference between the methods is sync vs. async and how
// they deliver return value or faults.

// SYNCHRONOUS (BLOCKING) APIS
// ==================================================
// If the server returns an error, it is thrown as an exception
-(MessageStatus *)publish:(NSString *)channelName 
                           message:(id)message 
                           publishOptions:(PublishOptions *)publishOptions 
                           deliveryOptions:(DeliveryOptions *)deliveryOptions;
                           
// If the server returns an error, it is delivered through the "fault" object           
-(MessageStatus *)publish:(NSString *)channelName 
                           message:(id)message 
                           publishOptions:(PublishOptions *)publishOptions 
                           deliveryOptions:(DeliveryOptions *)deliveryOptions 
                           error:(Fault **)fault;
                           
// ASYNCHRONOUS (NON-BLOCKING) APIS
// ==================================================
// Server's return value and errors are delivered through the responder object
-(void)publish:(NSString *)channelName 
                message:(id)message 
                publishOptions:(PublishOptions *)publishOptions 
                deliveryOptions:(DeliveryOptions *)deliveryOptions 
                responder:(id <IResponder>)responder;

// Server's return value and errors are delivered through the block-based callbacks
-(void)publish:(NSString *)channelName 
                message:(id)message 
                publishOptions:(PublishOptions *)publishOptions 
                deliveryOptions:(DeliveryOptions *)deliveryOptions 
                response:(void(^)(MessageStatus *))responseBlock 
                error:(void(^)(Fault *))errorBlock;
// These methods publish a message to the specified channel with publish options 
// and delivery options. Use these methods to send additional message headers 
// (including specialized headers for push notifications), publisher ID 
// and channel's subtopic. Additionally, configure delivery options to chose
// between singlecast (targetted delivery to specific devices) and broadcast
// (delivered to all devices of designates OS's), delayed publishing or
// repeated publishing.
// The only difference between the methods is sync vs. async and how
// they deliver return value or faults.

// SYNCHRONOUS (BLOCKING) APIS
// ==================================================
// If the server returns an error, it is thrown as an exception
func publish(_ channelName: String!, 
             message message: AniObject!, 
             publishOptions publishOptions: PublishOptions, 
             deliveryOptions deliveryOptions: DeliveryOptions) -> MessageStatus
                           
// If the server returns an error, it is delivered through the "fault" object           
func publish(_ channelName: String!, 
             message message: AniObject!, 
             publishOptions publishOptions: PublishOptions, 
             deliveryOptions deliveryOptions: DeliveryOptions, 
             error fault: AutoreleasingUnsafeMutablePointer<Fault?>) -> MessageStatus
             
// ASYNCHRONOUS (NON-BLOCKING) APIS
// ==================================================
// Server's return value and errors are delivered through the responder object
func publish(_ channelName: String!, 
             message message: AniObject!, 
             deliveryOptions deliveryOptions: DeliveryOptions, 
             response responseBlock: ((DeviceRegistration!) -> Void)!, 
             error errorBlock: ((Fault!) -> Void)!) -> Void

// Server's return value and errors are delivered through the block-based callbacks
func publish(_ channelName: String!, 
             message message: AniObject!, 
             publishOptions publishOptions: PublishOptions, 
             deliveryOptions deliveryOptions: DeliveryOptions, 
             response responseBlock: ((DeviceRegistration!) -> Void)!, 
             error errorBlock: ((Fault!) -> Void)!) -> Void

where:

channelName- name of the channel to publish the message to. If the channel does not exist, Backendless automatically creates it.
message- object to publish. The object can be of any data type - a primitive value, String, Date, a  user-defined complex type, a collection or an array of these types.
publishOptions- an instance of PublishOptions. When provided may contain publisher ID (an arbitrary, application-specific string value identifying the publisher), subtopic value and a collection of headers.
deliveryOptions- an instance of DeliveryOptions. When provided may specify options for message delivery such as: deliver only as a push notification (as opposed to a push notification and a pub/sub message), deliver to specific devices (singlecast) or a group of devices grouped by the operating system(broadcast), delayed delivery or repeated delivery.

Return value:

MessageStatus        - a data structure which contains message ID and message status:

@interface MessageStatus : NSObject
    @property (strong, nonatomic) NSString *messageId;
    @property (strong, nonatomic) NSNumber *status;
    @property (strong, nonatomic) NSString *errorMessage;
    -(id)initWithId:(NSString *)messageId;
    -(id)initWithId:(NSString *)messageId status:(PublishStatusEnum)status;
    -(id)initWithId:(NSString *)messageId status:(PublishStatusEnum)status errorMessage:(NSString *)errorMessage;
    
    -(PublishStatusEnum)valStatus;
    -(void)status:(PublishStatusEnum)status;
@end
class MessageStatus : NSObject {
        
   var messageId: String?
   var status: Int = 0
   var errorMessage: String?
}

Supported message statuses are:

PUBLISHED - message has been successfully published
SCHEDULED - message has been put into queue for delivery, it will be published immediately as soon as computing resources become available within Backendless
FAILED - message publishing failed. See the errorMessage property in MessageStatus for details.

Errors:

The following errors may occur during the message publishing API call. See the Error Handling section for details on how to retrieve the error code when the server returns an error:

 

Error Code

Description

5003

Invalid repeatExpiresAt date in delivery options.

5007

User does not have the permission to publish messages

5030

Invalid publishAt date in the delivery options.

Examples:

Basic push notification

Targeting a group of devices (grouped by OS)

Targeting specific devices

Delayed publishing

Basic push notification
Synchronous Publish

  -(MessageStatus *)publishMessageAsPushNotificationSync:(NSString *)message
    {
        PublishOptions *publishOptions = [PublishOptions new];
        publishOptions.headers = @{@"ios-text":@"Push notification for iOS", 
                                   @"android-content-title":@"Notification title for Android", 
                                   @"android-content-text":@"Notification text for Android"};
                                       
        @try {
            MessageStatus *result = [backendless.messagingService 
                                             publish:"default" 
                                             message:message 
                                             publishOptions:publishOptions];
            NSLog(@"MessageStatus = %@ <%@>", result.messageId, result.status);
            return result;
        }
    
        @catch (Fault *fault) {
            NSLog(@"FAULT = %@ <%@>", fault.message, fault.detail);
            return nil;
        }
    }
    func publishMessageAsPushNotificationSync(message: String) -> MessageStatus? {
        
        let publishOptions = PublishOptions()
        publishOptions.headers = ["ios-text":"Notification for iOS ", 
                                  "android-content-title":"Notification title for Android", 
                                  "android-content-text":"Notification text for Android"]
        
        var error: Fault?
        let messageStatus = backendless.messaging.publish("default", 
                                message: message, 
                                publishOptions:publishOptions, 
                                error: &error)
        if error == nil {
            print("MessageStatus = \(messageStatus.status) ['\(messageStatus.messageId)']")
            return messageStatus
        }
        else {
            print("Server reported an error: \(error)")
            return nil
        }
    }

Asynchronous Publish

    -(MessageStatus *)publishMessageAsPushNotificationAsync:(NSString *)message
    {
        PublishOptions *publishOptions = [PublishOptions new];
        publishOptions.headers = @{@"ios-text":@"Push notification for iOS", 
                                   @"android-content-title":@"Notification title for Android", 
                                   @"android-content-text":@"Notification text for Android"};
    
        [backendless.messagingService
            publish:"default" message:message publishOptions:publishOptions
            response:^(MessageStatus *messageStatus) {
                NSLog(@"MessageStatus = %@ <%@>", messageStatus.messageId, messageStatus.status);
            }
            error:^(Fault *fault) {
                NSLog(@"FAULT = %@", fault);
            }
        ];
    }
    func publishMessageAsPushNotificationAsync(message: String) {
        
        let publishOptions = PublishOptions()
        publishOptions.headers = ["ios-text":"Notification for iOS ", 
                                  "android-content-title":"Notification title for Android", 
                                  "android-content-text":"Notification text for Android"]
        
        backendless.messaging.publish("default", message: message, publishOptions:publishOptions,
            response:{ ( messageStatus : MessageStatus!) -> () in
                print("MessageStatus = \(messageStatus.status) ['\(messageStatus.messageId)']")
            },
            error: { ( fault : Fault!) -> () in
                print("Server reported an error: \(fault)")
            }
        )
    }

Targetting a group of devices

Synchronous Publish

 -(MessageStatus *)publishMessageAsPushNotificationForDeviceGroupSync:(NSString *)message
    {
        DeliveryOptions *deliveryOptions = [DeliveryOptions new];
        [deliveryOptions pushPolicy:PUSH_ONLY];
        [deliveryOptions pushBroadcast:(FOR_ANDROID | FOR_IOS)];
    
        PublishOptions *publishOptions = [PublishOptions new];
        publishOptions.headers = @{@"ios-text":@"Push notification for iOS", 
                                   @"android-content-title":@"Notification title for Android", 
                                   @"android-content-text":@"Notification text for Android"};
        @try {
            MessageStatus *result = [backendless.messagingService publish:"default" message:message 
                                        publishOptions:publishOptions deliveryOptions:deliveryOptions];
            NSLog(@"MessageStatus = %@ <%@>", result.messageId, result.status);
            return result;
        }
    
        @catch (Fault *fault) {
            NSLog(@"FAULT = %@ <%@>", fault.message, fault.detail);
            return nil;
        }
    }
  func publishMessageAsPushNotificationForDeviceGroupSync(message: String) -> MessageStatus? {
        
        let deliveryOptions = DeliveryOptions()
        deliveryOptions.pushBroadcast(FOR_ANDROID.rawValue|FOR_IOS.rawValue)
        
        let publishOptions = PublishOptions()
        publishOptions.headers = ["ios-text":"Notification for iOS ", 
                                  "android-content-title":"Notification title for Android", 
                                  "android-content-text":"Notification text for Android"]
        
        var error: Fault?
        let messageStatus = backendless.messaging.publish("default", 
                                  message: message, 
                                  publishOptions:publishOptions, 
                                  deliveryOptions:deliveryOptions, 
                                  error: &error)
        if error == nil {
            print("MessageStatus = \(messageStatus.status) ['\(messageStatus.messageId)']")
            return messageStatus
        }
        else {
            print("Server reported an error: \(error)")
            return nil
        }
    }

Asynchronous Publish

-(MessageStatus *)publishMessageAsPushNotificationForDeviceGroupAsync:(NSString *)message 
    {
        DeliveryOptions *deliveryOptions = [DeliveryOptions new];
        [deliveryOptions pushBroadcast:(FOR_ANDROID | FOR_IOS)];
    
        PublishOptions *publishOptions = [PublishOptions new];
        publishOptions.headers = @{@"alert-text":@"Push notification for iOS", 
                                   @"android-content-title":@"Notification title for Android", 
                                   @"android-content-text":@"Notification text for Android"};    
        [backendless.messagingService
            publish:"default" message:message publishOptions:publishOptions 
                                              deliveryOptions:deliveryOptions
            response:^(MessageStatus *messageStatus) {
                NSLog(@"MessageStatus = %@ <%@>", messageStatus.messageId, messageStatus.status);
            }
            error:^(Fault *fault) {
                NSLog(@"FAULT = %@", fault);
            }
        ];
    }
    func publishMessageAsPushNotificationForDeviceGroupAsync(message: String) {
        
        let deliveryOptions = DeliveryOptions()
        deliveryOptions.pushBroadcast(FOR_ANDROID.rawValue|FOR_IOS.rawValue)
        
        let publishOptions = PublishOptions()
        publishOptions.headers = @{@"alert-text":@"Push notification for iOS", 
                                   @"android-content-title":@"Notification title for Android", 
                                   @"android-content-text":@"Notification text for Android"};          
        backendless.messaging.publish("default", message: message, publishOptions:publishOptions, 
                                      deliveryOptions:deliveryOptions,
            response:{ ( messageStatus : MessageStatus!) -> () in
                print("MessageStatus = \(messageStatus.status) ['\(messageStatus.messageId)']")
            },
            error: { ( fault : Fault!) -> () in
                print("Server reported an error: \(fault)")
            }
        )
    }

Targeting specific devices
Synchronous Publish

   -(MessageStatus *)publishMessageAsPushNotificationSync:(NSString *)message forDevice:(NSString *)deviceId
    {
        DeliveryOptions *deliveryOptions = [DeliveryOptions new];
        deliveryOptions.pushSinglecast = @[deviceId];
    
        PublishOptions *publishOptions = [PublishOptions new];
        publishOptions.headers = @{@"android-content-title":@"Notification title for Android", 
                                   @"android-content-text":@"Notification text for Android"};       
        @try {
            MessageStatus *result = [backendless.messagingService publish:"default" message:message
            publishOptions:publishOptions deliveryOptions:deliveryOptions];
            NSLog(@"MessageStatus = %@ <%@>", result.messageId, result.status);
            return result;
        }
    
            @catch (Fault *fault) {
        NSLog(@"FAULT = %@", fault);
        return nil;
        }
    }
    func publishMessageAsPushNotificationSync(message: String, deviceId: String) -> MessageStatus? {
        
        let deliveryOptions = DeliveryOptions()
        deliveryOptions.pushSinglecast = [deviceId]
        
        let publishOptions = PublishOptions()
        publishOptions.headers = ["android-content-title":"Notification title for Android", 
                                  "android-content-text":"Notification text for Android"]        
        var error: Fault?
        let messageStatus = backendless.messaging.publish("default", message: message, 
                                      publishOptions:publishOptions, 
                                      deliveryOptions:deliveryOptions, 
                                      error: &error)
        if error == nil {
            print("MessageStatus = \(messageStatus.status) ['\(messageStatus.messageId)']")
            return messageStatus
        }
        else {
            print("Server reported an error: \(error)")
            return nil
        }
    }

Asynchronous Publish

    -(void)publishMessageAsPushNotificationAsync:(NSString *)message forDevice:(NSString *)deviceId
    {
        DeliveryOptions *deliveryOptions = [DeliveryOptions new];
        deliveryOptions.pushSinglecast = @[deviceId];
    
        PublishOptions *publishOptions = [PublishOptions new];
        publishOptions.headers = @{@"android-content-title":@"Notification title for Android", 
                                   @"android-content-text":@"Notification text for Android"};     
        [backendless.messagingService
            publish:"default" message:message publishOptions:publishOptions 
                                              deliveryOptions:deliveryOptions
            response:^(MessageStatus *messageStatus) {
                NSLog(@"MessageStatus = %@ <%@>", messageStatus.messageId, messageStatus.status);
            }
            error:^(Fault *fault) {
                NSLog(@"FAULT = %@", fault);
            }
        ];
    }
func publishMessageAsPushNotificationAsync(message: String, deviceId: String) {
        
   let deliveryOptions = DeliveryOptions()
   deliveryOptions.pushSinglecast = [deviceId]
        
   let publishOptions = PublishOptions()
   publishOptions.headers = @{@"android-content-title":@"Notification title for Android", 
                              @"android-content-text":@"Notification text for Android"};          
        
   backendless.messaging.publish("default", message: message, 
                                  publishOptions:publishOptions, 
                                  deliveryOptions:deliveryOptions,
     response:{ ( messageStatus : MessageStatus!) -> () in
        print("MessageStatus = \(messageStatus.status) ['\(messageStatus.messageId)']")
     },
     error: { ( fault : Fault!) -> () in
        print("Server reported an error: \(fault)")
     }
   )
}

Delayed publishing

Synchronous Publish

    -(MessageStatus *)publishMessageSync:(NSString *)message withDelay:(NSTimeInterval)seconds
    {
        PublishOptions *publishOptions = [PublishOptions new];
        publishOptions.headers = @{@"android-content-title":@"Notification title for Android", 
                                   @"android-content-text":@"Notification text for Android"};  
                                   
        DeliveryOptions *deliveryOptions = [DeliveryOptions new];
        deliveryOptions.publishAt = [NSDate dateWithTimeIntervalSinceNow:seconds];
        [deliveryOptions pushPolicy:PUSHONLY];
    
        @try {
            MessageStatus *result = [backendless.messagingService publish:"default" 
                                     message:message 
                                     publishOptions:publishOptions
                                     deliveryOptions:deliveryOptions];
            NSLog(@"MessageStatus = %@ <%@>", result.messageId, result.status);
        return result;
        }
    
        @catch (Fault *fault) {
            NSLog(@"FAULT = %@", fault);
            return nil;
        }
    }
    func publishMessageSync(message: String, seconds: Double) -> MessageStatus? {
        
        let publishOptions = PublishOptions()
        publishOptions.headers = ["android-content-title":"Notification title for Android", 
                                  "android-content-text":"Notification text for Android"]    
                                          
        let deliveryOptions = DeliveryOptions()
        deliveryOptions.publishAt = NSDate(timeIntervalSinceNow: seconds)
        
        var error: Fault?
        let messageStatus = backendless.messaging.publish("default", 
                                message: message, 
                                publishOptions:publishOptions,
                                deliveryOptions:deliveryOptions, 
                                error: &error)
        if error == nil {
            print("MessageStatus = \(messageStatus.status) ['\(messageStatus.messageId)']")
            return messageStatus
        }
        else {
            print("Server reported an error: \(error)")
            return nil
        }
    }

Asynchronous Publish

    -(void)publishMessageAsync:(NSString *)message withDelay:(NSTimeInterval)seconds
    {
        PublishOptions *publishOptions = [PublishOptions new];
        publishOptions.headers = @{@"android-content-title":@"Notification title for Android", 
                                   @"android-content-text":@"Notification text for Android"};  
                                   
        DeliveryOptions *deliveryOptions = [DeliveryOptions new];
        deliveryOptions.publishAt = [NSDate dateWithTimeIntervalSinceNow:seconds];

        [backendless.messagingService
            publish:"default" message:message 
            publishOptions:publishOptions
            deliveryOptions:deliveryOptions
            response:^(MessageStatus *messageStatus) {
                NSLog(@"MessageStatus = %@ <%@>", messageStatus.messageId, messageStatus.status);
            }
            error:^(Fault *fault) {
                NSLog(@"FAULT = %@", fault);
            }
        ];
    }
    func publishMessageAsync(message: String, seconds: Double) {
        
        let publishOptions = PublishOptions()
        publishOptions.headers = ["android-content-title":"Notification title for Android", 
                                  "android-content-text":"Notification text for Android"]   
                                  
        let deliveryOptions = DeliveryOptions()
        deliveryOptions.publishAt = NSDate(timeIntervalSinceNow: seconds)
        
        backendless.messaging.publish("default", 
                                      message: message, 
                                      publishOptions:publishOptions,
                                      deliveryOptions:deliveryOptions,
            response:{ ( messageStatus : MessageStatus!) -> () in
                print("MessageStatus = \(messageStatus.status) ['\(messageStatus.messageId)']")
            },
            error: { ( fault : Fault!) -> () in
                print("Server reported an error: \(fault)")
            }
        )
    }

 


Please let us know how we can improve the documentation by leaving a comment. All technical questions should be posted to the Backendless Support forum. We do not respond to the technical questions on the documentation pages.: