ux4iot-react
v4.1.5
Published
React Hooks for ux4iot
Downloads
25
Readme
ux4iot-react
ux4iot is a tool for directly communicating with your IoT devices from your web frontend. Your React frontend gets access to Azure IoT Hub's communication primitives without having a custom-built backend middleware translating between IoT Hub and your user interface. No need to design a REST API so that your UI can offer IoT functionality.
Use the hooks in this library to implement your use cases for live data and for controlling devices.
As an example: Using live data in your React application is as easy as writing
const temperature = useTelemetry('myDevice', 'temperature');
in your React components.
This library provides hooks for:
useTelemetry
- Subscribe to a single telemetry key of a deviceuseMultiTelemetry
- Subscribe to telemetry of multiple devicesuseDeviceTwin
- Subscribe to device twin changesuseConnectionState
- Subscribe to connection state updates of a deviceuseMultiConnectionState
- Subscribe to connection states of multiple devicesuseDirectMethod
- Execute a direct method on a deviceusePatchDesiredProperties
- Update the desired properties of the device twinuseD2CMessages
- Use the raw messages sent by your devices
Prerequisites
In order to use this library you need to have an ux4iot instance deployed in your Azure subscription. Here is a link to a quickstart that explains how to deploy one. Here is the link to the Azure Marketplace offering.
Installation
Install ux4iot-react
in your frontend application:
npm install ux4iot-react
Documentation
Check out the Documentation for
- Additional options
- Hook API
- ux4iot Admin SDKs
- ux4iot Admin API
- Reference to other related libraries of the ux4iot service
Tests
- As ux4iot-react does not provide a lot of tests, the main features in this library are tested via integration tests in an internal repository.
Releasing
If you want to release a new version
git checkout master
- Increase the version based on your changed in package.json (usually minor)
git commit -m 'Release VERSION'
git tag VERSION -m 'Release VERSION'
git push
git push --tags
The tag pipeline of github actions will build the package and publish it to npm.