arcoirislabs / cordova-plugin-mqtt

MqTT Cordova Plugin for Apache Cordova (> v3.0)
MIT License
86 stars 49 forks source link

Differences with cordova websocket plugin along with mqtt.js? #12

Closed ken-vernaillen closed 8 years ago

ken-vernaillen commented 8 years ago

Can you explain what the differences are of using this plugin, next to using the cordova websocket plugin along with mqtt.js? Advantages? Disadvantages?

arcoirislabs commented 8 years ago

Advantages:-

  1. Easy to implement.
  2. Websocket plugin being supported widely on all the platforms ensure the uniform support on all the platforms.
  3. Good for the apps who want to port the mobile web code to a Cordova app.

Disadvantages:-

  1. No scope of implementing background operation. This plugin has no capability of operating in background yet but as the implementation is native, we do have plenty of room to implement sticky background service to keep it running in background.
  2. Creates an overhead on the Javascript thread due to MQTT.js. Possible reduction in performance.

Cordova MQTT plugin. Advantages:-

  1. Pure native client with JS bindings.
  2. Least overhead on the Javascript code.
  3. Event based topic bus to receive the payload.

Disadvantages:-

  1. Absence of background implementation but possibility to implement one, which has been planned for next release.

Although the MQTT.js and native library are same on the options and feature level but at the language level, Java library beats the Javascript counterpart. Also it is wise to let the native side do the heavy lifting rather than achieving it in Javascript.

ken-vernaillen commented 8 years ago

Thanks!