https://github.com/dreamfactorysoftware/df-iot
https://github.com/dreamfactorysoftware/df-iot
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dreamfactorysoftware/df-iot
- Owner: dreamfactorysoftware
- Created: 2016-05-03T17:21:24.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-12-06T22:36:32.000Z (over 2 years ago)
- Last Synced: 2025-03-05T00:35:02.171Z (over 1 year ago)
- Language: JavaScript
- Size: 60.5 KB
- Stars: 3
- Watchers: 9
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# df-iot
Requirements:
* an instance of Redis running on localhost
To setup:
```
git clone git@github.com:dreamfactorysoftware/df-iot.git
cd df-iot
npm install
npm install mqtt -g
```
The sessionToken inside `config.json` is created with:
```
curl -i -k -3 -X POST "http://localhost:8080/api/v2/system/admin/session" -d '{ "email" : "user@example.com", "password" : "pass123", "remember_me": true }' -H "Content-Type: application/json"
```
To launch:
```
node index.js --config config.json
```
To test, one one shell:
```
mqtt sub -u Fan1 -P Fan1 -v -t '#'
```
On another shell:
```
mqtt pub -u TempSensor1 -P TempSensor1 -v -t 'hello' -m '{ "hello": "world" }'
```
You can also use an HTTP endpoint to publish:
```
curl -v -X POST -H 'content-type: application/json' -H 'X-DF-DEVICEID: TempSensor1' -H 'X-DF-DEVICETOKEN: TempSensor1' -d '{ "some": "data" }' http://localhost:3000/p/hello
```
You can also set the `X-DF-RETAIN` header to `true` to set the message
as retained. The `X-DF-QOS` value can be used to set the MQTT QoS level
(0 or 1 are supported).