Ionic 2 and Azure IoT Hub


#1

I am making an Ionic2 mobile app that should get sensor data from the Azure Iot Hub.

In my current setup i have a Raspberry PI that sends the value to the iot hub. In my Device Explorer i can see the data coming in, so i’m guessing that works.

The question i have now is: how do i get my Ionic app to receive the messages?

according to the azure website, you can do a GET request with http to something like

https://{iotHubName}.azure-devices.net/devices/{DeviceId}/messages/devicebound?api-version=2016-02-03

although i highly doubt this is the best solution. i even tried this in Fiddler but all it gives me is a 404 Not Found;

I’ve seen some packages like azure-iot-device-* but then i dont know how to use that in Ionic2. because i dont know how to use var * = require(’ * '); in ionic2 as it uses import{ * } from *; like angular2

the only thing i want to do is, when i press the button in my app it should start receiving the data from the azure iot hub and when i press it again, it should stop receiving