If you went through thetaonelab.com's blog and codebase, you might have realised that it's a little difficult to implement the gps-fuzzer due to instructions not being very clear. I have summarised the way to do it in a step-by-step guide below.
- nodejs & npm
- mosquitto
- checkout gps-fuzzer - backend server for producing random lat-long for front-end to consume
- checkout Implementation-of-gps-fuzzer
- Go to Map.js file in Implementation-of-gps-fuzzer and replace existing
var client = ...with your local mosquitto setupvar client = mqtt.connect("ws://127.0.0.1:8080", {clientId: "dfndmnfnbsfb_client"}) - Go to server.js file of gps-fuzzer and replace existing
var client = ...with your local mosquitton setupvar client = mqtt.connect("mqtt://127.0.0.1", {clientId: "dfndmnfnbsfb_server"})
- Follow the instructions mentioned here
- Restart Mosquitto server
- Run backend server:
cd gps-fuzzer && npm i && npm start - start fuzzing by hitting the backend server
curl --location 'http://localhost:9999/fuzzgps' \
--header 'Content-Type: application/json' \
--data '{
"payload":{
"tripId":15,
"deviceId":123
},
"points":[{ "lati": 25.30, "longi": 88.30 }, { "lati": 24.30, "longi": 88.00 } , { "lati": 25.30, "longi": 89.00 }],
"topic":"eyezon/livegps",
"interval":400,
"duration":4000,
"loop":true
}'
- Subscribe on command line to check if it's actually publishing:
mosquitto_sub -h localhost -t eyezon/livegps --id dfndmnfnbsfb_cmd_client - Run front-end:
cd Implementation-of-gps-fuzzer && npm i && npm start - The last command will open web-browser at port localhost:3000 and you'll see a small vehicle moving randomly