Publish a Location
To send a location to Wia, connect to the MQTT API and publish it to the locations topic.
The events MQTT topic is:
locations
or devices/{DEVICE_ID}/locations
To send a location to Wia, connect to the MQTT API and publish it to the locations topic.
The events MQTT topic is:
locations
or devices/{DEVICE_ID}/locations
// Create an instance of Wia
// Replace 'd_sk_abcdef' with your device secret key
var wia = require('wia')('d_sk_abcdef');
// Listen for a successful connection to the MQTT API
wia.stream.on('connect', function() {
// Publish a location
wia.locations.publish({
latitude: 35.689487,
longitude: 139.691706
});
});
// Connect to the MQTT API
wia.stream.connect();
We serve cookies on this site to analyse traffic and optimise your experience. By using the website you agree to the Privacy Policy.