Integration Options
To get data from your devices into your application, you have a few options. We look at some of the more common ones here.
MQTT
Message Queue Telemetry Transport (MQTT) is a common protocol for machine-to-machine communication that was created by Andy Stanford-Clark of IBM, and Arlen Nipper (then of Arcom Systems, later CTO of Eurotech). The protocol became very popular in the Internet of Things technical community because it was designed as an easy-to-use and lightweight publish/subscribe messaging transport.
MQTT endpoints are exposed by the network server on which device activations and messages are published. It also allows you to publish downlink messages in response.
The MQTT data received from this endpoint is data driven. This means the application will receive the data as it occurs, without a request from the application. We call this a push-based data model.
The advantage here is that data is received as soon as it is available. This is a disadvantage when your application is not ready to receive data for some reason, your data can get lost. The MQTT client needs to have an open connection to the broker of the network server to receive messages. MQTT might not be suitable in situations where the connection cannot be sustained during a long-running process.
HTTP
Hypertext Transfer Protocol (HTTP) is a well-known protocol for transmitting data of any type across web servers. Implementing an HTTP web server is rather easy, no matter what programming language you use.
Within HTTP there are two primary approaches used by network servers to allow you to receive the data; HTTP webhooks, which push data to your server when it is received, and an HTTP API, which allows you to pull data from the network server at any time.
HTTP Webhooks
Similar to MQTT, HTTP webhooks are provided so you can send data to the application in real-time.
When enabled, the HTTP webhooks integration sends an HTTP request to the HTTP endpoint that you have configured (usually the web server), containing the payload of the event.
Again, this is data-driven, since the webhooks will be triggered as the data comes in. HTTP webhooks are therefore also push-based.
In contrast to MQTT however, the application using HTTP webhooks does not require an open connection to the network server. Rather, it needs to be available to handle the incoming HTTP requests.
This might make it more suitable in situations where a long-running process is not applicable (such as AWS Lambda functions).
For more information on using the HTTP webhook integration, read the Create an Application Integration content in the Semtech Network Server User Guide. (Reading time: 3 minutes)
HTTP API
Network servers may store the data sent by devices to the application for a limited period of time. The Semtech Network Server stores the last ten events.
Network servers may then expose an API that you can use to fetch the stored data when you need it, in contrast to the push-based models of the MQTT and the HTTP integrations. We call this model pull-based. The Semtech Network Server provides an API for retrieving the stored data for a given device.
In the pull-based approach, the application does not get the data as soon as it comes in, but only when it asks for it. This is useful for applications that need historical data and don't need to respond to events in real-time.
In the Advanced Assignment section we show you how to access the API provided by the Semtech Network Server.