We're going to start with the uplink stream. 1
That is the most common situation since the LoRaWAN end-device usually sends much more data than it 2
receives. From the user side, 3
we want to retrieve the message sent by the end-device and now stored on the LoRaWAN server. 4
The first idea is to make a request from our user application, 5
so from the IoT platform. We can do this by making an HTTP GET request. 6
When we make an HTTP GET request to a web server, it returns the content of the HTML page requested. 7
Now, in the same way, when we make an HTTP GET request to the LoRaWAN server, then it will return 8
the last message received. 9
The most common way to present the answer is to use the widely used JSON format. 10
It's not the more efficient way to represent things in terms of size, but a text format is very convenient. 11
So, if we analyze this situation, who is doing what? The IoT platform is the HTTP client, it requests 12
the message. And the LoRaWAN server, 13
iIs the HTTP server. 14
It answers the request with the corresponding messages. 15
Great. 16
I think it's clear for the uplink. 17
Let's talk about downlink. From the LoRaWAN server, we now want to retrieve 18
if a command LED ON or LED OFF has been used on IoT platform. 19
So we can imagine that the IoT platform has a virtual switch on the mobile application, for example, and 20
regularly the LoRaWAN server requests the IoT platform to check if a command is pending. 21
So, the idea here is to make the request from the LoRaWAN server and the IoT platform replies with the 22
switch command statue: basically ON or OFF. 23
In that case: the LoRaWAN server is the HTTP client, 24
it requests for the user switch status. 25
And the IoT platform is the HTTP server, 26
it answers the request with the corresponding switch status. 27
Now, the last thing we need to know is how to send an HTTP request if we are a client. 28
And of course, how do we build an answer if we are a server. For the request, 29
The HTTP GET format is really simple because what we need is the URL corresponding to the request. 30
One request > one URL. 31
But we can't guess which URL we need to use, so we have to dive in the documentation and read it. 32
We'll do it, and find out the right URL and maybe some other nice option that we could add in the request. 33
And of course, not everyone is allowed to make this request, so we'll need a way to be authentified. 34
Let's now make a demonstration of this integration.