SOBRE ESTE BLOG

IBM Messaging blog: Find out all the new and great things that are going on with IBM MQ as well as what our developers are doing and talking about. This blog follows the IBM Social Computing Guidelines.

Identificações

The definitive article on using the MQ Telemetry Transport Protocol (MQTT) in a hybrid mobile app, developed for the Android platform, using IBM® Worklight Studio.

MQ Telemetry Transport (MQTT) protocol is a lightweight publish/subscribe messaging protocol, designed specifically for sending data over networks where connectivity is intermittent or bandwidth is at a premium. Compared to HTTP, MQTT imparts a number of advantages to a mobile app including faster response times, higher throughput, lower battery use and much lower bandwidth use (Facebook Messenger makes use of the MQTT protocol because of these attributes). MQTT's efficient use of network and battery power, along with its integration with enterprise messaging middleware, makes it well suited to use cases where an enterprise application needs to push data or interact with one or more phone apps.

In this article, we give you the tools to develop a simple Worklight app to send and receive messages over MQTT, and provide all the supporting information you need to design and build your own apps.

To help you, we show the approach we have taken of developing the app in HTML and Javascript, using the Cordova (PhoneGap) libraries provided with Worklight to interface to the native code that implements the MQTT protocol. We also show how you can interface to the MQTT protocol via an Android Service. We demonstrate the function and design of the native components, the Javascript api that is used to provide access to them and how to configure a Worklight Studio project to use them.

Here's a diagram showing how it all fits together...

We also provide you with a sample app, along with all the relevant code required to enable the user get up to speed on building their own apps quickly and easily.