Unknown macro: {next_previous_link3}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Push notifications are used to send messages to devices. If you have configured WSO2 IoT Server to push notifications to the devices via Firebase Cloud Messaging (FCM) or Apple Push Notification (APNS), the notification is sent to the devices, the devices requests for the pending operations, and the server returns the list of pending operations, which the devices then execute.

When many devices try communication with the server at the same time, the server crashes. To avoid this situation WSO2 IoT Server implemented a task to manage the number of devices communicating with the server at a given time. The task sends the notifications to the devices in batches. This way at a given time only a defined number of devices will communicate with the server.

Let's take a look at how you can configure the push notification scheduling task:
  1. Open the <IOTS_HOME>/conf/cdm-config.xml file and make sure the SchedulerTaskEnabled that is under PushNotificationConfiguration is enabled. This configuration is enabled by default.

    In a clustered environment make sure to enable this task only in the manager node and not the worker nodes. Else, the server crashes when the worker nodes start pushing notifications along with the manager node. 

    <PushNotificationConfiguration>
       <SchedulerBatchSize>1000</SchedulerBatchSize>
       <SchedulerBatchDelayMills>60000</SchedulerBatchDelayMills>
       <SchedulerTaskInitialDelay>60000</SchedulerTaskInitialDelay>
       <SchedulerTaskEnabled>true</SchedulerTaskEnabled>
       <PushNotificationProviders>
          <Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.FCMBasedPushNotificationProvider</Provider>
          <!--<Provider>org.wso2.carbon.device.mgt.mobile.impl.ios.apns.APNSBasedPushNotificationProvider</Provider>-->
          <Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.MQTTBasedPushNotificationProvider</Provider>
          <Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.XMPPBasedPushNotificationProvider</Provider>
       </PushNotificationProviders>
    </PushNotificationConfiguration>
    SchedulerBatchSizeDefine how many devices or the device batch size the notifications needs to be sent at a given time.
    By default, the notification is sent to 200 devices at a given time. If you have less than 200 devices registered with WSO2 IoT Server, the notification will be sent to all those devices.
    SchedulerBatchDelayMillsDefine after how many milliseconds the notifications needs to be sent to the next batch of devices.
    By default, the next batch of devices will get the notification after 60,000 milliseconds, which is in a minute.
    SchedulerTaskInitialDelayThe server will not send notifications to the devices soon as it starts. Therefore, define when the push notification schedule task needs to start. The value needs to be defined in milliseconds.
    By default, the task starts 60,000 milliseconds or one minute after the server starts.
    SchedulerTaskEnabledEnable the push notification scheduler task. If it is is not enabled, WSO2 IoT Server will send the push notifications to all the registered devices in one go. This might result in the server crashing as explained above.
    PushNotificationProvidersThe default push notifications that are supported and implemented in WSO2 IoT Server.
  2. Configure the device type to run the push notification scheduler task.
    Navigate to the <IOTS_HOME>/repository/deployment/server/devicetype directory, open the <DEVICE_TYPE>.xml file, and configure the field given below:
    The default configuration in the android.xml file is shown below:

    <PushNotificationProvider type="FCM" isScheduled="false">--> <!--</PushNotificationProvider>

    The task for the FCM push notification method is disabled for the Android device type by default. Therefore, all the Android devices registered with WSO2 IoT Server will receive the push notifications at once and the devices will communicate with the server at the same time. If you want to change this default behavior, enable the scheduler task for the device type.

    <PushNotificationProvider type="FCM" isScheduled="true">--> <!--</PushNotificationProvider>

     NOTE: In WSO2 IoT Server, the Android devices are configured to send notifications via the local notification method by default.

  • No labels