This project includes Live Objects Client code samples for the MQTT protocol.
- LiveObjects official help includes a dev. guide mqtt section
- Samples are written in JavaScript for node.js.
- Samples require minimal common environment described in "Quick start" below.
Clone this repository from GitHub:
$ git clone https://github.com/boly38/lo-mqtt-nodejs.git
- Install NodeJs (https://nodejs.org/en/download/)
- Install samples dependencies (from package.json, example, https://github.com/mqttjs/MQTT.js)
npm install
- copy the template in a private file
cp .env.template .env.dontpush.myEnv1
cp .env.template .env.dontpush.myEnv2
- edit
.env.dontpush.myEnv1
- application rely on
.env
file
cp .env.dontpush.myEnv1 .env
lo-device - a mqtt client using device mode
.
This client is able to :
- connect, disconnect, forceReconnect. and via features:
- receive and handle command, process firmware updates, process config update.
- publish current config/resource, send data messages.
The client "controller" asks to the user the order via terminal and input.
Controller features:
- geolocation: generates X devices from given square : ex.
europe
,france
,lyon
.
To start the client:
node ./src/device-mode/lo-device.js
Then use h
to display help.