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

Example Code

// 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();