Enabling MQTT Service in Background in Hybrid Applications for iOS environment

I'm using MobileFirst Platform 7.1 with Paho MQTT (Internet of Things), I'm trying to implement a Hybrid Application with mqtt for Android and iOS.

I have tested the app in Android and it is working as expected, when it is in the foreground and background,

While in iOS, it does not work as expected. It works correctly in the foreground, but not in the background. I was testing using the iPhone Simulator of XCode and iPhone 6.

I found a project which implemented with MobileFirst and MQTT. from https://developer.ibm.com/mobilefirstplatform/documentation/integration/mq-telemetry-transport/

i am just adding host and port number and adding android,ios environment.but same problem facing android working iOS not.

at this moment what can i do ?


in iOS, it works correctly foreground.but when i send background the "MQTT client" connection lost form broker.

this method fire :

this.client.onConnectionLost = function() {
        alert("Connection lost!");

on the other hand , android , windows it work perfectly for foreground and background

For example :

I have a room there have a PIR sensor. it work like publisher . my application user is a subscriber .

when user out the room that that time she open application,subscribe and send application background.

anytime someone entire the room that time , she will be get a notification.


Details on how to run in the background on iOS can be found here. This link also lists the actions that Apple allows to run in the background, if your app does not meet those criteria then it is likely to get bumped from the app store.

The list also shows which UIBackgroundModes to place in your Info.plist to flag that your app needs background access.

I can not found at least one way to mange it for hybrid application ,tried with several way ,failed and mange it easily for native application MQTT iOS background.


Plan support for new platforms (iOS, Windows Phone)

Add background service support in Android version

more check this link https://github.com/arcoirislabs/cordova-plugin-mqtt

Need Your Help