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 5 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) for Android devices or Apple Push Notification (APNS) for iOS devices, 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.

If 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 the defined number of devices will communicate with the server and the load can be managed without the server crashing.

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 the clustered environment enable this task only in the manager node and not the worker nodes. This is because the server will crash when the worker nodes start pushing notifications too. 

    <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 batch size the notification needs to be sent at a given time.
    By default, the notification is sent to 200 devices at one 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 notification 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 start sending notifications to the device soon as it starts. Therefore, define in milliseconds how long after starting the server should the push notification schedule task start.
    By default, the task starts 60,000 milliseconds or one minute after the server starts.
    SchedulerTaskEnabledEnable the push notification scheduler task. If this 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 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: By default Android devices are configured to push notifications via the local notification method.

  • No labels